Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing NULL and receiving a value from stored procedure
Message
From
18/01/2006 10:27:08
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
18/01/2006 10:25:01
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01087987
Message ID:
01087990
Views:
13
>Hello all,
>
>With VFP 8 and SQL Server 2005 CTP:
>
>I need to pass a null value from VFP to call a SQL Server SP, but this parameter is declared as OUTPUT, and in fact, it must return a specific value.
>
>Let's assume this VFP code:
>
>lcVar = .NULL.
>lnExec = SQLEXEC(lnH, 'Exec sp_test ?@lcVar')
>
>
>When testing lnExec < 0, the error message is:
>1526 Connectivity error Microsoft][ODBC SQL Server Driver] Invalid character value for cast specification
>
>Is there any error in this logic? or any additional syntax required?
>
>The argument is declared like this:
>@cState char(7)=NULL OUTPUT
>
>
>The stored procedured runs without errors from SQL Query analizer and it accepts the null value, but I keep receiving the error message when trying from VFP.
>
>Thanks for any comment.
>
>Juan C.

It may help to make sure the variable is of the correct type. Not all nulls are created equal!
lcVar = "" && Forces type to "C"
lcVar = .NULL.
lnExec = SQLEXEC(lnH, 'Exec sp_test ?@lcVar')
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Reply
Map
View

Click here to load this message in the networking platform