Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return @@Identity (yet again)
Message
From
19/10/2004 11:00:42
 
 
To
18/10/2004 20:20:59
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00952482
Message ID:
00952636
Views:
8
Shoot, also needed to pass the OUTPUT parameter field by reference:
Exec Attribute_InsProc @Description=?ca_Attribute.Description,@id=?@ca_Attribute.kAttribute OUTPUT
>I'm an idiot. I forgot to include the "OUTPUT" in the VFP side stored procedure call.
>
>Should have been:
>
>Exec Attribute_InsProc @Description=?ca_Attribute.Description,@id=?ca_Attribute.kAttribute OUTPUT
>
>
>Aloha,
>
>James
>
>>Hi All,
>>
>>I know this subject has been beaten to death on these boards, but I have gone through old posts on this forum and others and just cannot get this to work. It's using SQL Stored Procedures through the CursorAdapter class.
>>
>>Here's the SQL Stored Proc:
>>
>>CREATE PROCEDURE Attribute_InsProc
>>       ( @Description NVARCHAR(30), @id int Output )
>>AS
>>BEGIN
>>   BEGIN TRAN
>>      INSERT INTO Attribute
>>             ( Description )
>>      VALUES ( @Description )
>>     Select @id = SCOPE_IDENTITY( )
>>      IF (@@error!=0)
>>         BEGIN
>>         RAISERROR  20000  'Attribute_InsProc: Cannot insert because primary key value not found in Attribute'
>>         ROLLBACK TRAN
>>         RETURN(1)
>>      END
>>   COMMIT TRAN
>>END
>>
>>
>>Here is the CursorAdapter InsertCmd value:
>>
>>Exec Attribute_InsProc @Description=?ca_Attribute.Description,@id=?ca_Attribute.kAttribute
>>
>>
>>It is my understandig that the new ID value should be placed in kAttribute. I append a record and TableUpdate(.T.). TableUpdate executes OK but the new ID value is not in the cursor. Any ideas? Did I go wrong somewhere?
>>
>>Aloha,
>>
>>James
Previous
Reply
Map
View

Click here to load this message in the networking platform