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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 @@identity will not return

Author  Topic 

taylo
Yak Posting Veteran

82 Posts

Posted - 2001-07-22 : 20:02:10
This is not a general "How do I use @@identity" question.

Can anyone tell me why the ASP code below is not returning the @@identity? This should work no problem but for whatever reason the @@identity is NULL.

SQLUSer = "INSERT INTO USERS (UserName,Password,Status,First,Last,Email,Address1,Address2,City,State,Zip,Phone,Code) VALUES('"&UserName&"','"&pwd&"',3,'"&vfn&"','"&vln&"','"&vem&"','"&vadd1&"','"&vadd2&"','"&vcity&"','"&vstate&"','"&request.form("zip")&"','"&request.form("phone")&"','"&code&"')"
DataConn.execute(SQLUser)

SQLID = "Select @@identity AS NewID"
set rsNewID = DataConn.execute(SQLID)
Session("CustID") = rsNewID("NewID")

   

- Advertisement -