Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Stored Procedures and ADO
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01059935
Message ID:
01119343
Vues:
22
>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform