AlanGlynSmith
Programmer
Hi, Been trying to achieve this over the last 5 years given up, and continued finding other ways around the problem. I have just revisited the problem and am determined to find a solution. I want to add a new record to a table using a stored procedure and check the returned ID it works perfectly in "SQL Query Analyzer". But trying to call the procedure from VB6 I simply cannot find a way to get at the Returned Identity of the record just added
this is the sproc...
CREATE PROCEDURE [spInsertAdminSection]
@SectionName_2 varchar (50)
AS INSERT INTO [test].[dbo].[tblAdminSections]
(SectionName)
VALUES
(@SectionName_2)
Select Scope_Identity() As Id
As I said this works perfectly using the syntax
spInsertAdminSection "Test" using "SQL Query Analyzer" and it returns the correct next ID.
How the heck do you get the equivalent code to work thru VB6 so far have tried
set rstemp = cn1.spInsertAdminsection Var1
(gets error 3001)
where rstemp is an Adodb.recordset
then tried setting the recordset to capture the returned value as in...
cn1.spinsertadminsection Var1, rstemp
(gets error 3001)
How do you get at the returned ID in VB code is it thru the Connection?
a feeble plea for help???
this is the sproc...
CREATE PROCEDURE [spInsertAdminSection]
@SectionName_2 varchar (50)
AS INSERT INTO [test].[dbo].[tblAdminSections]
(SectionName)
VALUES
(@SectionName_2)
Select Scope_Identity() As Id
As I said this works perfectly using the syntax
spInsertAdminSection "Test" using "SQL Query Analyzer" and it returns the correct next ID.
How the heck do you get the equivalent code to work thru VB6 so far have tried
set rstemp = cn1.spInsertAdminsection Var1
(gets error 3001)
where rstemp is an Adodb.recordset
then tried setting the recordset to capture the returned value as in...
cn1.spinsertadminsection Var1, rstemp
(gets error 3001)
How do you get at the returned ID in VB code is it thru the Connection?
a feeble plea for help???