Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Invalid call issued while executing a SQLEXEC( ) sequenc
Message
From
14/08/2002 22:48:28
 
 
To
14/08/2002 20:43:50
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00689793
Message ID:
00689836
Views:
33
Bob,

Thanks. I see now that I had misunderstood the use of these functions. I thought you were supposed to call sqlexec once and then keep calling sqlmoreresults() until the sqlexec was done. I hadn't fully read about the return values for sqlexec. I realize now that any of the four functions,
sqlexec, sqlmoreresults, sqlcolumns, and sqltables, if the connection is set to asynchronous, must be called in a loop, until the return value indicates that they have finished executing, and that if you try to execute another SPT statement before they have finished, you will get the error.

However, I am still a little hazy on the use of sqlmoreresults(). Could you provide an example of using it, especially with respect to how to provide different cursor names to each result set - I didn't understand the vfp documentation on this.


(BTW - thanks for your recommendation for sql-server-performance.com in a previous post to me - it was very helpful)

>Actually, you are supposed to continue calling SQLEXEC() until returns <> 0. If it returns less than zero, you have an error. If it returns more than zero, you have result set(s).
>
>SQLMoreResults() is used to get multiple results sets.
>
>BOb
>
>
>>I received the error:
>>
>>Invalid call issued while executing a SQLEXEC( ) sequence (Error 1474)
>>
>>
>>when executing the code below. Actually, this was just test code that I set up in the hope of debugging the error:
>>
>>Invalid call issued while executing a SQLMORERESULTS( ) sequence (Error 1475) in another context.
>>
>>I wanted to execute code in the way that I understood it to be recommended when asynchronous is .t. and batchmode is false. My understanding was that I would execute sqlmoreresults repeatedly until It returned 2 - no more data.
>>I don't know what is wrong with this code.
>>
>>The vfp help for error 1474 says:
>>
>>An invalid SQL pass-through (SPT) function call has been made while a SQLEXEC( ) call was expected to continue the SPT call sequence in progress.
>>
>>I don't understand what they mean when they say a sqlexec() call was expected to continue the spt call. I thought I am supposed to issue sqlmoreresults - not reissue sqlexec().
>>
>>Can someone explain this to me?
>>
>>In the other case, the help for error 1475 says:
>>
>>
>>An invalid SQL pass-through (SPT) function call has been made while a SQLMORERESULTS( ) call was expected to continue the SPT call sequence in progress. Call SQLCANCEL( ) to cancel the SPT sequence or make valid SPT calls to finish the call sequence.
>>
>>This makes sense to me - I got error 1475, when I tried to execute a NEW SPT STATEMENT, with the same connection handle, before the current one was finished executing, because, I think, sqlmoreresults() had not yet returned 0. (unfortunately, I can't see the sqlmoreresults code executing - it is locked up in an exe for a portion of a system that I don't have access to (Visual accountmate accounting - which hides pieces of its source)
>>
>>
>>
>>
>>
>>
>>
>>
>>open data data\buds
>>lnhandle=sqlconnect('vamconnect')
>>lnres=sqlsetprop(lnhandle,'batchmode',.f.)
>>lnre2=sqlsetprop(lnhandle,'asynchronous',.t.)
>>lnres3=sqlexec(lnhandle,'select * from sostrs','mycursor')
>>lncounter=0
>>do while .t.
>>
>> ** get error 1474 upon executing this line
>> lndata=sqlmoreresults(lnhandle)
>> wait wind str(lndata) nowait
>> do case
>> case lndata= 0
>> loop
>> case lndata=1
>> loop
>> case lndata=2
>> exit
>> otherwise
>> wait wind 'error'
>>
>> endcase
>> lncounter=lncounter+1
>>enddo
>>?lncounter
Previous
Reply
Map
View

Click here to load this message in the networking platform