Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ODBC & Stored Procedures
Message
From
21/07/1999 13:07:26
Bob Lucas
The WordWare Agency
Alberta, Canada
 
 
To
20/07/1999 11:51:53
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00243624
Message ID:
00244237
Views:
14
>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).
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform