|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
What is the Best way to fetch the most recent updated row in a databaseI 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 check out www.betav.com - Articles, MSDN - Retrieving the Gozoutas
-- Show quoteHide quoteW.G. Ryan, MVP www.tibasolutions.com | www.devbuzz.com | www.knowdotnet.com <jag***@gmail.com> wrote in message 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 you using Access database?
-- Show quoteHide quoteMiha Markic [MVP C#] - RightHand .NET consulting & development SLODUG - Slovene Developer Users Group www.rthand.com <jag***@gmail.com> wrote in message 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 > 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) -- Show quoteHide quoteMiha Markic [MVP C#] - RightHand .NET consulting & development SLODUG - Slovene Developer Users Group www.rthand.com <jag***@gmail.com> wrote in message news:1106933143.116234.202490@c13g2000cwb.googlegroups.com... > Hi Miha, > > I am using Access database. >
Other interesting topics
Question about SQLDataReader
Concurrency in N tiers How do I filter a child table through its parent? Looking for ideas on how to handle a specific data situation. help to nav through DataReader infoMessage Truncated # of pooled connections seem too high OleDbParameter doesn't update value correctly preventing new rows in datagrids when using relations Dataset created in Code cannot be used in Crystal Reports designer |
|||||||||||||||||||||||