Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning values from an SQL stored procedure
Message
De
05/08/2004 15:08:09
 
 
À
03/08/2004 05:18:05
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00930255
Message ID:
00931123
Vues:
25
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform