Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2000-09-12 : 00:07:44
|
Tom writes "Hi SQLTEAM,
I developed a website using Active Server Pages in combination with an Access database. When the website worked well I decided to upsize it to SQL Server 7.0.
Usualy you have to make small modifactions to get it working but I stumbled upon a problem that I cant solve in a good manner. The @@Identity global variable doesnt work under all circumstances. I read on SQLTEAM how to get this variable using the INSERT statement but all my code uses ADO to set the values. After I use the .Update method the Identity is lost.
Here's the code : =========================================================== rs.open table, connection, 2, 2 rs.AddNew rs("test1") = "test" rs("test2") = "test" rs("test3") = "test" rs.Update
dim rsIdentity set rsIdentity = server.CreateObject("ADODB.RecordSet") rsIdentity.Open "SELECT @@identity As ID", conn ===========================================================
rsIdentity("ID") returns nothing !
This code works well with an access database. I cannot simply reprogram my application because that would take quite a while. My question comes to this : How can I get the Identity of a row after the .Update method.
Currently I sort Descending an move to the last records. This solution is not realy multi user and slow. Can you realy realy smart guys help me out ???" |
|
|
|
|
|