![]() | |
![]() |
| | Thread Tools | Display Modes |
#11
| |||
| |||
|
|
I am writing an ASP.NET application, and am forced to use Access as my database. I need a way to return the id (which is an AutoNumber field in the table I am inserting into) of a record when I insert it. In SQL Server, I am able to use a statement like the following: INSERT INTO tablename (fieldnames) OUTPUT inserted.id VALUES(valuestoinsert) Take note of the OUTPUT inserted.id part of this statement. This returns the value of the field named 'id' for the record that was just inserted. Unfortunately, this technique does not work in Access. Is there any way to retrieve the id of the record that was just inserted when using Access? Any help would be appreciated. Thanks. -- Nathan Sokalski njsokalski (AT) hotmail (DOT) com http://www.nathansokalski.com/ |
#12
| |||
| |||
|
|
Nathan, After the insert statement you need to do a Select @@Identity statement to retrieve the generated ID value. Kerry Moorman "Nathan Sokalski" wrote: I am writing an ASP.NET application, and am forced to use Access as my database. I need a way to return the id (which is an AutoNumber field in the table I am inserting into) of a record when I insert it. In SQL Server, I am able to use a statement like the following: INSERT INTO tablename (fieldnames) OUTPUT inserted.id VALUES(valuestoinsert) Take note of the OUTPUT inserted.id part of this statement. This returns the value of the field named 'id' for the record that was just inserted. Unfortunately, this technique does not work in Access. Is there any way to retrieve the id of the record that was just inserted when using Access? Any help would be appreciated. Thanks. -- Nathan Sokalski njsokalski (AT) hotmail (DOT) com http://www.nathansokalski.com/ |
#13
| |||
| |||
|
|
Nathan, After the insert statement you need to do a Select @@Identity statement to retrieve the generated ID value. Kerry Moorman "Nathan Sokalski" wrote: I am writing an ASP.NET application, and am forced to use Access as my database. I need a way to return the id (which is an AutoNumber field in the table I am inserting into) of a record when I insert it. In SQL Server, I am able to use a statement like the following: INSERT INTO tablename (fieldnames) OUTPUT inserted.id VALUES(valuestoinsert) Take note of the OUTPUT inserted.id part of this statement. This returns the value of the field named 'id' for the record that was just inserted. Unfortunately, this technique does not work in Access. Is there any way to retrieve the id of the record that was just inserted when using Access? Any help would be appreciated. Thanks. -- Nathan Sokalski njsokalski (AT) hotmail (DOT) com http://www.nathansokalski.com/ |
#14
| |||
| |||
|
|
Nathan, After the insert statement you need to do a Select @@Identity statement to retrieve the generated ID value. Kerry Moorman "Nathan Sokalski" wrote: I am writing an ASP.NET application, and am forced to use Access as my database. I need a way to return the id (which is an AutoNumber field in the table I am inserting into) of a record when I insert it. In SQL Server, I am able to use a statement like the following: INSERT INTO tablename (fieldnames) OUTPUT inserted.id VALUES(valuestoinsert) Take note of the OUTPUT inserted.id part of this statement. This returns the value of the field named 'id' for the record that was just inserted. Unfortunately, this technique does not work in Access. Is there any way to retrieve the id of the record that was just inserted when using Access? Any help would be appreciated. Thanks. -- Nathan Sokalski njsokalski (AT) hotmail (DOT) com http://www.nathansokalski.com/ |
#15
| |||
| |||
|
|
Nathan, After the insert statement you need to do a Select @@Identity statement to retrieve the generated ID value. Kerry Moorman "Nathan Sokalski" wrote: I am writing an ASP.NET application, and am forced to use Access as my database. I need a way to return the id (which is an AutoNumber field in the table I am inserting into) of a record when I insert it. In SQL Server, I am able to use a statement like the following: INSERT INTO tablename (fieldnames) OUTPUT inserted.id VALUES(valuestoinsert) Take note of the OUTPUT inserted.id part of this statement. This returns the value of the field named 'id' for the record that was just inserted. Unfortunately, this technique does not work in Access. Is there any way to retrieve the id of the record that was just inserted when using Access? Any help would be appreciated. Thanks. -- Nathan Sokalski njsokalski (AT) hotmail (DOT) com http://www.nathansokalski.com/ |
#16
| |||
| |||
|
|
Nathan, After the insert statement you need to do a Select @@Identity statement to retrieve the generated ID value. Kerry Moorman "Nathan Sokalski" wrote: I am writing an ASP.NET application, and am forced to use Access as my database. I need a way to return the id (which is an AutoNumber field in the table I am inserting into) of a record when I insert it. In SQL Server, I am able to use a statement like the following: INSERT INTO tablename (fieldnames) OUTPUT inserted.id VALUES(valuestoinsert) Take note of the OUTPUT inserted.id part of this statement. This returns the value of the field named 'id' for the record that was just inserted. Unfortunately, this technique does not work in Access. Is there any way to retrieve the id of the record that was just inserted when using Access? Any help would be appreciated. Thanks. -- Nathan Sokalski njsokalski (AT) hotmail (DOT) com http://www.nathansokalski.com/ |
#17
| |||
| |||
|
|
Nathan, After the insert statement you need to do a Select @@Identity statement to retrieve the generated ID value. Kerry Moorman "Nathan Sokalski" wrote: I am writing an ASP.NET application, and am forced to use Access as my database. I need a way to return the id (which is an AutoNumber field in the table I am inserting into) of a record when I insert it. In SQL Server, I am able to use a statement like the following: INSERT INTO tablename (fieldnames) OUTPUT inserted.id VALUES(valuestoinsert) Take note of the OUTPUT inserted.id part of this statement. This returns the value of the field named 'id' for the record that was just inserted. Unfortunately, this technique does not work in Access. Is there any way to retrieve the id of the record that was just inserted when using Access? Any help would be appreciated. Thanks. -- Nathan Sokalski njsokalski (AT) hotmail (DOT) com http://www.nathansokalski.com/ |
#18
| |||
| |||
|
|
Nathan, After the insert statement you need to do a Select @@Identity statement to retrieve the generated ID value. Kerry Moorman "Nathan Sokalski" wrote: I am writing an ASP.NET application, and am forced to use Access as my database. I need a way to return the id (which is an AutoNumber field in the table I am inserting into) of a record when I insert it. In SQL Server, I am able to use a statement like the following: INSERT INTO tablename (fieldnames) OUTPUT inserted.id VALUES(valuestoinsert) Take note of the OUTPUT inserted.id part of this statement. This returns the value of the field named 'id' for the record that was just inserted. Unfortunately, this technique does not work in Access. Is there any way to retrieve the id of the record that was just inserted when using Access? Any help would be appreciated. Thanks. -- Nathan Sokalski njsokalski (AT) hotmail (DOT) com http://www.nathansokalski.com/ |
#19
| |||
| |||
|
|
Nathan, After the insert statement you need to do a Select @@Identity statement to retrieve the generated ID value. Kerry Moorman "Nathan Sokalski" wrote: I am writing an ASP.NET application, and am forced to use Access as my database. I need a way to return the id (which is an AutoNumber field in the table I am inserting into) of a record when I insert it. In SQL Server, I am able to use a statement like the following: INSERT INTO tablename (fieldnames) OUTPUT inserted.id VALUES(valuestoinsert) Take note of the OUTPUT inserted.id part of this statement. This returns the value of the field named 'id' for the record that was just inserted. Unfortunately, this technique does not work in Access. Is there any way to retrieve the id of the record that was just inserted when using Access? Any help would be appreciated. Thanks. -- Nathan Sokalski njsokalski (AT) hotmail (DOT) com http://www.nathansokalski.com/ |
#20
| |||
| |||
|
|
Nathan, After the insert statement you need to do a Select @@Identity statement to retrieve the generated ID value. Kerry Moorman "Nathan Sokalski" wrote: I am writing an ASP.NET application, and am forced to use Access as my database. I need a way to return the id (which is an AutoNumber field in the table I am inserting into) of a record when I insert it. In SQL Server, I am able to use a statement like the following: INSERT INTO tablename (fieldnames) OUTPUT inserted.id VALUES(valuestoinsert) Take note of the OUTPUT inserted.id part of this statement. This returns the value of the field named 'id' for the record that was just inserted. Unfortunately, this technique does not work in Access. Is there any way to retrieve the id of the record that was just inserted when using Access? Any help would be appreciated. Thanks. -- Nathan Sokalski njsokalski (AT) hotmail (DOT) com http://www.nathansokalski.com/ |
![]() |
| Thread Tools | |
| Display Modes | |
| |