Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SP Call to VFP backend
Message
From
16/10/2001 05:30:04
 
 
To
16/10/2001 00:23:43
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00568870
Message ID:
00568904
Views:
25
Hi!

It is depended on what you're gouing to return from SQL Server. When this is SQl Server 2000 and you use a function-like SP, no need to use separate table:
SQLEXEC(nHandle,'SELECT SP_TEST() AS result')
"FROM" is not required on SQL Server. You can return this way values of system variables on SQL Server.

When you want to return a recordset from the usual SP, when this result set is created by a query inside of SP:
SQLEXEC(nHandle,'exec SP_TEST','SPResult')
When you want to return a return code from the usual stored procedure, put it into the variable and then return it:
DEFINE CRLF chr(13)+chr(10)
SQLEXEC(nHandle,'declare @nCode int' + CRLF+ ;
                'exec @nCode=SP_TEST'+CRLF+;
                'select @nCode as result','SPResult')
HTH.


>I am developing an n-tier application. For now, I'd like to have my VFP middle tier use ODBC to connect to a VFP datasource. The back-end data will have several stored procedures that my middle tier will need to call.
>
>How do I call a stored procedure in a VFP database via SQL Pass thru. As a work-around, I put a one-row-table, called SP, in the vfp database and use SQLEXEC to send a query to the DB with the stored procedure as a column. Like this:
>
>SQLEXEC(nHandle,'SELECT SP_TEST() AS result FROM SP','SPResult')
>
>Although this works, it seems kind of silly. There must be a better way.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform