Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Direct ODBC calls
Message
From
27/06/2003 18:20:03
Gary Foster
Pointsource Consulting LLC
Chanhassen, Minnesota, United States
 
 
To
27/06/2003 16:37:04
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00802290
Message ID:
00804930
Views:
29
>>Aleksey,
>>
>>>Can you be more specific?
>>I'm not sure how to describe this other than the examples below. Basically, VFP 8 using MS SQL Server works, VFP 8 using Sybase doesn't. I have to assume that the behind-the-scenes way VFP parses the SQL string and passes that to the ODBC driver isn't compatable with the Sybase drivers I've tested. There could be a setting in Sybase to start this working, but I don't know them. Short story: Just use MS SQL Server<g>. It works better than Sybase in other ways as well.
>>
>>>What VFP version are you using?
>>8.0
>>
>>>How exactly SQLEXEC fails?
>>When it fails, I get a failure result code and the parameter is not updated. The exact failure depends on the way the output param is constructed. For example here are a few permutations and error messages:
>>
>>?@NewKey output --> Connectivity error: [INTERSOLV][ODBC SQL Server driver]Character, decimal, and binary parameters cannot have a precision of zero. Error in parameter 1.
>>
>>@NewKey output --> Connectivity error: [INTERSOLV][ODBC SQL Server driver][SQL Server]Must declare variable '@NewKey'.
>>
>>@NewKey --> Connectivity error: [INTERSOLV][ODBC SQL Server driver][SQL Server]Must declare variable '@NewKey'.
>>
>>NewKey output --> Connectivity error: [INTERSOLV][ODBC SQL Server driver][SQL Server]Can't use the OUTPUT option when passing a constant to a stored procedure.
>>
>>Here is how I get around it now:
>>
>>*-- Build a SQL statement that declares a variable, calls the proc and
>>*-- SELECTs the variable in order to produce a result set I can read.
>>cSQL=[declare @cNextValue char(12)]+CHR(13)+CHR(10)+;
>> [exec GetNextID 'KeyFieldName', @cNextValue output]+CHR(13)+CHR(10)+;
>> [select @cNextValue]
>>
>> SQLExec(nConnection, cSQL, 'curResults')
>>
>> cNewKey = curResults.exp
>>
>>Works like a champ, but I'll probably explore the direct ODBC API calls just to get the experiance.
>>
>>Gary
>>
>Hi Gary,
>
>The following calls are wrong because '?' marker is missing:
>>SQLExec(nConHand,[exec MySp 'SomeValue', @cOutParam]) && Fails
>>SQLExec(nConHand,[exec MySp 'SomeValue', @cOutParam OUTPUT]) && Fails
>>SQLExec(nConHand,[exec MySp 'SomeValue', @cOutParam OUTPUT],'MyCursor')&& Fails
>
>Try to put something into cOutParam, for example, single space.
>And then call SQLExec(nConHand,[exec MySp 'SomeValue', ?@cOutParam]).
>Let me know if it works.
>
>Thanks,
>Aleksey.

Aleksey,
I've tried everything. Same results.

LOCAL cOutParam
PUBLIC cOutParam
LOCAL cOutParam as string
PUBLIC cOutParam as char
cOutParam = ''
cOutParam = ' '
cOutParam = ' '
etc., etc., etc.

Gary
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform