tags:

views:

25

answers:

1
rs.Open "select * from applicationdetailstable", con, adOpenDynamic, adLockOptimistic
If rs.BOF = False Then
    disp
End If

End Sub

Sub disp()
    Text1.Text = rs.Fields(1)
    Text2.Text = rs.Fields(2)
End Sub

Private Sub Command1_Click()
    ' Move First
    rs.MoveFirst
    disp
End Sub

Private Sub Command2_Click()
    ' Move Previous
    rs.MovePrevious

    If rs.BOF Then rs.MoveFirst
    disp
End Sub

Private Sub Command3_Click()
    'Move Next

    rs.MoveNext
    If rs.EOF Then rs.MoveLast
    disp
End Sub

Private Sub Command4_Click()
    'Move Last
    rs.MoveLast
    disp
End Sub

This is the coding in visual basic

Am using access as my back end.

I need the same function in vb.net.

Am using the same 4 command buttons (move first, previous, next and last) Wat is the code that i could use ?

+2  A: 

You have a couple options. In the .Net world we've moved from using the ADO RecordSet object to either DataSets or DataReaders.

To read individual rows you can check out the SQLDataReader class: http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.aspx

Alternatively, you can load your whole set of data into a DataSet object and iterate over it's Rows collection: http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx

And for reference, here's a link showing the differences between ADO and ADO.Net: http://msdn.microsoft.com/en-us/library/904fck4k%28VS.71%29.aspx

Jacob Ewald
+1 for being nice and providing msdn documentation. I, on the other hand, am going to be submiting this code to the www.thedailywtf.com
wllmsaccnt