• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 288
  • Last Modified:

VB.net SQL selecting the last record appended

In Vb.net I am appending data to a SQL database using the following code
    oSQL = "Insert Into Table1 ([oDate],[oText], [oNumber]) Select '" & oDate & "' as Expr1, '" & oText & "' as Expr2, " & oNumber & " as Expr3"
I want to select the last row appended to make sure that it actually was. Since the ID field is automatically generated this is a little tricky
Murray Brown
Murray Brown
  • 2
1 Solution
FROM Table1

Or if it's an Identity field you can look into SCOPE_IDENTITY().

What exactly are you wanting to do with selecting the record back?

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Great answer. Didn't expect that. Thanks
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
To clarfy the MAX part sufficed
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now