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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get @@Identity value back

Status
Not open for further replies.

vbmorton

Technical User
Dec 27, 2004
44
US
Hi, was wondering if anyone can assist me and trying to get a value back from sqlserver2000.
my connection is ADODB



Code:
 Dim strsql As String
   On Error GoTo Proc_error
 Dim rsTest As Recordset
 Set rsTest = New Recordset
 Dim strtest As String

 With g_clsConnections
   .Connect
 End With

    
    strsql = "EXEC sp_Projectadd '12', '99', 'vbmorton' "

rsTest.Open strsql, g_clsConnections, adOpenStatic
Set rsTest = rsTest("Select @@Identity")
strtest = rsTest(0)


My table is 3 columns long, with the 4th being the primary key (identity - increments by 1)

am i on the right track or not close at all?? any assistance would be welcome.

thanks.
vbmorton

 
Try this thread: thread669-995243

I had the same problem, and there are a few different approaches mentioned.

BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top