Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Stored Procedures and ADO
Message
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01059935
Message ID:
01119343
Views:
21
>>We are trying to use VFP DBC w/ stored procedures VIA ADO.
>>
>>However the problem I run into is that I am trying to use ADO.COMMAND for paramters, but can't seem to get it to work. I would prefer not to put it into the commandtext statement.
>
>Below's runnable sample code that shows how to call VFP SP with 2 date type parameters
#INCLUDE ado.h
>lcConStr = "Provider=vfpoledb;Data Source="+HOME(2)+"northwind\northwind.dbc"
>oCon = CreateObject("ADODB.connection")
>oCmd = CreateObject("ADODB.Command")
>
>oCon.Open(lcConStr)
>oCmd.ActiveConnection = oCon
>oCmd.CommandType = adCmdStoredProc
>
>* A Date type parameters
>ldBeginning_Date = {^1997/01/01}
>ldEnding_Date = {^2100/12/31}
>oCmd.CommandText = [SalesByYear(?,?)]
>oPar = oCmd.CreateParameter(ldBeginning_Date, ;
>		adDBDate, adParamInput, , ldBeginning_Date)
>oCmd.Parameters.Append(oPar)
>oPar = oCmd.CreateParameter(ldEnding_Date, ;
>		adDBDate, adParamInput, , ldEnding_Date)
>oCmd.Parameters.Append(oPar)
>
>oRs = oCmd.Execute()
>
The same for one character parameter
>oCmd.CommandText = [CustOrdersOrders(?)]
>lcCustomerID = "TOMSP"
>oPar = oCmd.CreateParameter(lcCustomerID, ;
>		adVarChar, adParamInput, LEN(lcCustomerID), lcCustomerID)
>oCmd.Parameters.Append(oPar)
>oRs = oCmd.Execute()
>
Can you return VFP cursor using this approach?
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform