Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
I have forgotten how to pass Params using SQLEXEC()
Message
 
 
To
27/01/2004 12:19:03
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00871025
Message ID:
00871026
Views:
12
Mark,

The SQL Server always accepts single quotes as string delimiter. The double quotes are only allowed as string delimiters if SET QUOTED_IDENTIFIER is OFF. The parameters in SQLEXEC() are prefixed with "?" (Question mark). I'm not sure why do you prefix SP name with "#" in SQLEXEC(). You should check for SQLEXEC() return value and in case of error use AERROR() to get detailed info about ODBC error.
lnRet = SQLEXEC(tn, [exec sp_udepartment 0, 'test'])
IF lnRet = -1
  AERROR(...)
  * Process ODBC error
ENDIF
...
v1=0
v2="test"

lnet = SQLEXEC(tn, 'exec sp_udepartment ?v1, ?v2')
IF lnRet = -1
  AERROR(...)
  * Process ODBC error
ENDIF
...
>Its late and I have forgotten how to pass params to SQL Server SP from VFP
>Everything I try returns -1
>
>My connection is fine
>
>I have tried variations on the following
>
>tn=SQLCONNECT('dataprot')
>? SQLEXEC(tn, 'exec #sp_udepartment 0,"test"')
>
>v1=0
>v2="test"
>
>? SQLEXEC(tn, 'exec #sp_udepartment v1,v2')
>
>and also
>
>? SQLEXEC(tn, 'exec #sp_udepartment @v1,@v2')
>
>
>
>Here is the SP I am trying to call. There is a chance I have the SP wrong since I am still a novice with SQL Server.
>
<snip>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform