C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » General »

How to find the Largest value in the table


Posted Date: 15 Sep 2008    Resource Type: Code Snippets    Category: General
Author: gopiMember Level: Silver    
Rating: 1 out of 5Points: 10



this code says " how to find the largest value/number in the table "

1st add the follwing namespace


Imports System.Data.SqlClient

Dim intCnt As Integer
Dim intI As Integer
Dim strQuery As String
Dim strValue As String = ""
Dim intValue As Integer
Dim objDS As New DataSet
Dim objDT As New DataTableFor intI = 0 To intCnt - 1
If strValue.Length = 0
Then'Create query as per u r requirement.
strQuery = "Select max(LastPurPrc) from oitm" Else
strQuery = "Select max(LastPurPrc) from oitm where LastPurPrc not in (" & strValue & ")"

End If

'Create dataset objDS using query strQuery
objDT = objDS.Tables(0)
If objDT.Rows.Count > 0 Then
intValue = objDT.Rows(0).Item(0)
If strValue.Length = 0
Then strValue = CStr(intValue)
Else

strValue = strValue & "," & CStr(intValue)
End If
End If
Next

MessageBox.Show(intValue)




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Table  .  Largest value  .  How to  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Removing duplicate value and sort values in string array
Previous Resource: Dynamic Safe array
Return to Discussion Resource Index
Post New Resource
Category: General


Post resources and earn money!
 
Related Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use