HighTechTalks DotNet Forums  

acces last row in dataset

VB.net Controls microsoft.public.dotnet.languages.vb.controls


Discuss acces last row in dataset in the VB.net Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
douglas
 
Posts: n/a

Default acces last row in dataset - 09-25-2009 , 10:57 PM






I would like to know how to access the last row in a dataset using the
following
logic. (*Note: the line of code that says 'do something is where I want to
access the last row in the dataset. )
**Note I am using visual basic.net 2005 professional version at work
dim da As New SqlDataAdapter
Dim ds As New DataSet()
da = New SqlDataAdapter(sqlCmd)
sqlCmd.Connection = New SqlConnection(connectionString)
sqlCnn.Open()
da = New SqlDataAdapter(sqlCmd)
sqlCmd.CommandText = sqlCmd.CommandType = CommandType.StoredProcedure
da.Fill(ds)

strholdnumber = 'gets a value
Dim IntTotalRows As Integer = ds.Tables(0).Rows.Count
Dim intFileRows As Integer = UBound(aryFi)
For A = 0 To ds.Tables(0).Rows.Count - 1
For intCntr = 0 To UBound(aryFi) Step 1
If Trim(strholdnumber) = Case(Mid(aryFi(intCntr).Name, 12,5 ))
'do something
End If

Next intCntr
next

the line of code that says: For A = 0 To ds.Tables(0).Rows.Count - 1
,keeps me from accessing the last line.

Thanks!

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.