Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ODBC & Stored Procedures
Message
De
21/07/1999 13:07:26
Bob Lucas
The WordWare Agency
Alberta, Canada
 
 
À
20/07/1999 11:51:53
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00243624
Message ID:
00244237
Vues:
17
>I have used ODBC to access SQL Server in the past, so you can imagine my surprise to find that the VFP ODBC does not expose Stored Procedures to the client. Is there a way to run a stored procedure through ODBC, specifically useing ASP pages.

I have followed this thread a bit and I still don't understand your problem. there is no difficulty using SQL Passthrough to execute stored procedures. A simple process would be to define a string and call SQLEXEC. I have an object that I pass the call to but it would be like this:
cSQL = "SBBenefitHistoryAdj '" + This.PHN + "', " + ;
ALLTRIM( STR( This.Filenum ) ) + ", " + ;
"'" + This.AdjPeriod + "', " + ;
ALLTRIM( STR( nUpdate ) ) + " "

nRetCode = This.asbsql.sqlexec( cSQL, 'benhist' )
this call to the stored proc SBBenefitHistoryAdj returns a cursor call benhist.

A more complicated call is used when returning values to passed parameters, or passing parameter values. Here is an example:

cSQL = "{CALL SBBenefitHistory ( '" + This.PHN + "', " + ;
ALLTRIM( STR( This.Filenum ) ) + ", " + ;
"'" + This.CurrentPeriod + "', " + ;
"'" + This.UserID + "', " + ;
ALLTRIM( STR( nUpdate ) ) + ", " + ;
"?@cbenefitperiod, ?@cbenefittype, " + ;
"?@cannualBenefitflag, ?@nmonthlyBenefitamt, " + ;
"?@nannualBenefitamt, ?@ccreateddate, " + ;
"?@nPersonalKey) }"


nRetCode = This.asbsql.sqlexec( cSQL )

Note the use of {} curly braces and the inclusion of the CALL Keyword. This stored procedure call does not return a cursor but it does update the variables passed as parameters by reference. (The stored proc must also define them as OUTPUT parameters).
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform