Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SP Call to VFP backend
Message
From
16/10/2001 16:35:08
 
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00568870
Message ID:
00569293
Views:
31
Apparently, in order to retrieve a return value, I first need to use the "adCmdStoredProc" CommandType, then set up a Parameter object, append that param. object to the Command object's parameter collection and then execute the command at which time the Parameter(0) object should contain the return value. the problem is, I can't get the stored procedure command type (adCmdStoredProc) to work when calling the vfp stored procedure. Instead I get the Ole error "Unrecognized Command Verb"

So, either this CommandType is simply not valid when the data source is a VFP dbc, or I am missing something in the CommandText. Here's the exact code I have:

*** Begin *****
#INCLUDE "C:\Program Files\Microsoft Visual Studio\Vfp98\VFPCOM\adovfp.h"
oCN=CREATEOBJECT('ADODB.Connection')
oCN.ConnectionString='Provider=VFPOLEDB.1;Data Source=c:\kba\admindata\kba_data.dbc'
oCN.Open()

oRS=CREATEOBJECT('ADODB.RecordSet')
oRS.ActiveConnection=oCN
oRS.Open('SELECT * FROM TASK')

oCM=CREATEOBJECT('ADODB.Command')
oCM.ActiveConnection=oCN
oCM.CommandText='SP_TEST'
oCM.CommandType=adCmdStoredProc

oPM=oCM.CreateParameter("Return",adInteger,adParamReturnValue,0,0)
oCM.Parameters.Append(oPM)

oCM.Execute()

? oCM.Parameters(0).Value

**** End *****

And the SP in the database is simple:
FUNCTION SP_TEST
RETURN 9

BTW, I tried several different variations of the CommandText, including SP_TEST(). When I change the CommandType to adCmdText, I don't get any errors, but the return value is always .NULL.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform