What is the Best way to fetch the most recent updated row in a database

J

jagrat

I am having an OleDBDataAdapter and a dataset. I fill the dataset with
a row and execute

Adapter.update(dataset,"Table Name");
Adapter.fill(dataset,"Table Name");

For the database table, my primary key is an auto number.

Currently, I am fetching the key using:

dataset.Tables["Table Name"].Rows[0].ItemArray[0]

It is working because this is the only row added into my table.
But I am certain that there should be a better alternative to this.
Waiting for response.

Jag
 
M

Miha Markic [MVP C#]

Hi,

Check out
Retrieving Identity or Autonumber Values
..net help topic.
MSDN Oct link
(ms-help://MS.VSCC.2003/MS.MSDNQTR.2004OCT.1033/cpguide/html/cpconretrievingidentityorautonumbervalues.htm)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top