Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning values from an SQL stored procedure
Message
From
05/08/2004 15:08:09
 
 
To
03/08/2004 05:18:05
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00930255
Message ID:
00931123
Views:
23
Derek,

You can do that by modifying the stored procedure to have an output parameter.

Modify your stored procedure as follows:

CREATE Procedure ApplicationLoginInsert1 @lcParam1 char(128), @lcOutput char(10) output
AS
insert into ApplicationLogin (Login_PC) values (@lcParam1)
declare @lnLoginID int
exec @lnLoginID = Version1.dbo.ApplicationLogin.Login_ID
return (@lnLoginID)
GO

Then call it using the following syntax :

lcParam1 = 'MyPCName'
lcOutput = space(10)
=SQLExec(lnConnection, "execute ApplicationLoginInsert1 ?lcParam1,?@lcOutput")

This should return the login id. Note: In the example I assumed the id is of character data type. You can change it to what you want.

Also make sure to declare the output parameter to the proper datatype.

Regards,
Navneet
Previous
Reply
Map
View

Click here to load this message in the networking platform