Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SP Call to VFP backend
Message
 
 
À
16/10/2001 13:51:11
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Divers
Thread ID:
00568870
Message ID:
00569163
Vues:
25
>Craig,
> I am using ADO now, as you suggested. However, I am still having trouble calling a Stored Procedure from my back-end vfp database. Here is the code I tried:
>
>#INCLUDE adovfp.h
>oCN=CREATEOBJECT('ADODB.Connection')
>oCN.ConnectionString='Provider=VFPOLEDB.1;Data Source=c:\Mypath\MyDB.dbc'
>oCN.Open()
>
>oRS=CREATEOBJECT('ADODB.RecordSet')
>oRS.ActiveConnection=oCN
>oRS.Open('SELECT * FROM MyTable)
>
>oCM=CREATEOBJECT('ADODB.Command')
>oCM.ActiveConnection=oCN
>oCM.CommandText='SP_TEST()'
>oCM.CommandType=adCmdText
>
>oRS=oCM.Execute()
>
>? oRS.Fields[1].Value
>
>The Connection opens no problem. The RecordSet performs the query on MyTable no problem. The Execute method of the command also appears to work (ie no errors) But, since my stored procedure, SP_TEST returns an integer, how do I get at the return value?
>
The return Value from SP is stored in the Parameters collection of the command object
lnResult = oCM.Parameters(0).Value
Actually it's the way it works with SQL Server SP's. I'm not sure about VFP but you can try.
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform