Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

@@Identity issue 1

Status
Not open for further replies.

44nato44

Programmer
Dec 12, 2008
115
NL
Hi

I am not sure why this does not work here, the same code is used on another page on the same site, but with another insert statement.

The record gets added but when I do the @@Identity it will not show the number, any ideas ?

sqlstr = "INSERT INTO tblTaskToolSandbox ([ProjectID], [PriorityID], [StatusID], [ShortDescription], [Comments], [Budget], [Requested_Date], [Estimated_Date],[Requestor],[EngDeadAgree]) VALUES (20,2,1,'" & replace(vartxtShortDesc,"'","''") & "', '" & replace(vartxtComments,"'","''") & "' ,0, " & amdate(now()) & "," & amdate(now()) & "," & Session("UserID") & ",0) "
Conn.execute(sqlstr)

sql = "SELECT @@IDENTITY AS varNum"
rs.Open sql , DSNTA, 2

response.write "-" & rs.fields("varNum") & "-"
response.end
 
Yeps, I am using Identity on another page on the same table and there it works
 
thanks guitarzan .......... I guess there is something about looking at a problem for too long .. you become blind
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top