Getting the last record autonumber value
-
Im using access database to store some customer information.
I have a table with an autonumber field.
I want to get the value of the autonumbered field, for the last added record in that table? So i can use it as my Customer ID for the next entry of customer details.
if the last generated autonumber is
Ex:
100 ->the next customer id should be 101, can anyone please help or can point me to the right direction :)
how do i do it using ado.net? Just learning c# and ado.net :)
+============================================================================ Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
-
Im using access database to store some customer information.
I have a table with an autonumber field.
I want to get the value of the autonumbered field, for the last added record in that table? So i can use it as my Customer ID for the next entry of customer details.
if the last generated autonumber is
Ex:
100 ->the next customer id should be 101, can anyone please help or can point me to the right direction :)
how do i do it using ado.net? Just learning c# and ado.net :)
+============================================================================ Many of life's failures are people who did not realize how close they were to success when they gave up." Thomas A. Edison
-
Don't use the pre tag on the message. The font isn't that easy to read, and the text doesn't wrap. After you insert a record, use the query "select @@identity" to get the id that was created for the record.
--- b { font-weight: normal; }
thanks Guffa for the reply ill check it out :) Sorry for the pre tag :)
-
Don't use the pre tag on the message. The font isn't that easy to read, and the text doesn't wrap. After you insert a record, use the query "select @@identity" to get the id that was created for the record.
--- b { font-weight: normal; }
yes, Rows = table.Select("select @@identity"); in Sql Server INSERT INTO jobs (job_desc,min_lvl,max_lvl) VALUES ('Accountant',12,125) SELECT @@IDENTITY AS 'Identity' @@IDENTITY is SQL system variable datatable have very SQL method , So you think dataset like a small SQl server
Agree ...