|
-
Mar 24th, 2024, 07:04 AM
#1
Thread Starter
New Member
SQL help pls
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
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|