Groups | Blog | Home
all groups > sql server clients > may 2004 >

sql server clients : DB-Library error 10038


Yog
5/19/2004 4:51:04 AM
Hi There

We have VC++6.0 based application which uses DB-Library calls to communicate with the SQL Server2000 database
There is typical scenario in the application where we want to process the result of a multiple-row based query in WHILE loop and execute another query inside WHILE loop based on the data in the result fetched

The psuedo-code is as belo

While (result.fetch()

//prepare where clause based on the data in the row fetche
char* strWhere= ..

//Execute the Query on the same connection using db-lib AP

//Fetch the result



But DB-Library do not allow such scenario and throws below error
"DB-Library error 10038: Attempt to initiate a new SQL Server operation with results pending.

Because of the tightly coupled business logic, its impossible to change the WHILE LOOP and also the flow of the application

Is there any solution for above said problem

Thanks in advance

Regards
sanchans NO[at]SPAM online.microsoft.com
5/21/2004 2:42:41 PM
This is a problem which typically arises when the results from an ongoing
command are still being processed.

In your scenario, you have probably sent a command to the server before all
results from a previous command have been processed.

To overcome this problem, the only way is to wait for the results to
process from the first query and then start the new query in the same
session.

Please also review this very helpful link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dblibc/dbc_
pdc02_4sxl.asp

Hope this helps.

sanchans@online.microsoft.com

This posting is provided "AS IS" with no warranties, and confers no rights.
AddThis Social Bookmark Button