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 below
While (result.fetch())
{
//prepare where clause based on the data in the row fetched
char* strWhere= ...
//Execute the Query on the same connection using db-lib API
//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,
Yog
Yog,
You will need to either fetch all the values first, close the result set,
and then do your inner loop query logic or use two separate connections to
the same database. Just like the error message says, the problem is that you
have initiated an operation that still has data to be retrieved from the
server and then attempted to execute another query.
Jim
"Yog" <y.bang@.zensar.com> wrote in message
news:C638CAD8-C4E2-49DE-955B-BE0B34977DD2@.microsoft.com...
> 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 below
> While (result.fetch())
> {
> //prepare where clause based on the data in the row fetched
> char* strWhere= ...
> //Execute the Query on the same connection using db-lib API
> //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,
> Yog
Tuesday, February 14, 2012
DB-Library error 10038
Labels:
application,
based,
calls,
communicate,
database,
db-library,
error,
microsoft,
mysql,
oracle,
scenario,
server,
server2000,
sql,
typical,
vc6
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment