Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Executing a SQL Server stored procedure
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00482118
Message ID:
00482234
Views:
8
Hi Sanjay,

>hi,
> How can i execute a sql stored procedure with parameters from VFP?
>
> I have a stored procedure in sql server with 2 inputs parameters and 1 output parameter how can i execute & retrieve the value in output parameter from VFP. Is there a way to trap SQL or ODBC error msgs from VFP?
>
>sanjay.

I see you've been given alot of advice about trapping the error. To get the output parameter value back prefix the variable name with ?@. It can even be a local variable. I also 'seed' the variable with the proper datatype. For example, the following will execute my stored procedure to get a new Primary Key for a Claim:
local lnId, lnResult

lnId = 0
lnResult = SqlExec(g_oAppMain.nConnHdl, "Exec SpMc_GetNewId 'CLAIM', ?@lnId")
if lnResult < 0
...
HTH,
Bill Armbrecht
VFP MCP
Previous
Reply
Map
View

Click here to load this message in the networking platform