Hi there,
I recently started using VB.NET and doing my first VB/SQL project.
I have very basic question.
In VB 6 I used to get the last record result through below SQL (OleDB)
Dim LastRecord as Integer
adoPrimaryRS1.Open "Select * from BUY ORDER BY ID ASC", dB4, adOpenStatic, adLockOptimistic
adoPrimaryRS1.MoveLast
LastRecord = adoPrimaryRS1.Fields!Id
and now I am using SQL Server client, could you please tell me how to achieve above. I am using the below code.
Dim cmd As SqlCommand = New SqlCommand("SELECT TOP 1 ID FROM dbo.Accounts ORDER BY ID DESC", CON)
Dim DA As New SqlDataAdapter(cmd)
Dim DT As New DataTable
Many thanks in advance.
Kh

