Home All Groups Group Topic Archive Search About

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

Author
28 Jan 2005 4:59 PM
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

Author
28 Jan 2005 5:16 PM
W.G. Ryan eMVP
check out www.betav.com - Articles, MSDN - Retrieving the Gozoutas

--
W.G. Ryan, MVP

www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com
<jag***@gmail.com> wrote in message
Show quoteHide quote
news:1106931590.480728.88580@c13g2000cwb.googlegroups.com...
> 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
>
Are all your drivers up to date? click for free checkup

Author
28 Jan 2005 5:17 PM
Miha Markic [MVP C#]
Are you using Access database?

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

<jag***@gmail.com> wrote in message
Show quoteHide quote
news:1106931590.480728.88580@c13g2000cwb.googlegroups.com...
>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
>
Author
28 Jan 2005 5:25 PM
jagrat
Hi Miha,

I am using Access database.
Author
28 Jan 2005 9:36 PM
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)

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

<jag***@gmail.com> wrote in message
Show quoteHide quote
news:1106933143.116234.202490@c13g2000cwb.googlegroups.com...
> Hi Miha,
>
> I am using Access database.
>

Bookmark and Share