Re: DB-Library error 10038
From: Aaron Collver (aaron_collver_at_yahoo.com)
Date: 05/19/04
- Next message: Wayne Snyder: "Re: trigger question"
- Previous message: Wayne Snyder: "Re: SQL Query Performance"
- In reply to: Yog: "DB-Library error 10038"
- Next in thread: Erland Sommarskog: "Re: DB-Library error 10038"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 19 May 2004 06:56:51 -0500
If I'm correct, you're looping through the results using a while which means
that result set is still associated with the connection. I guess if you
can't change the while loop, you're stuck using a second connection for the
inner part of the while loop. An alternative (without knowing what you're
actually doing) would be to loop through and store the results necessary to
create the inner query in an array. Then you can close the first result set
and execute the inner queries on the same connection using the results
stored in the array. Perhaps there's a way to encapsulate the functionality
you want in a stored procedure (but that's a shot in the dark cause I don't
know what you're doing).
Hope that helps,
Aaron
Disclaimer: I'm merely a student
"Yog" <y.bang@zensar.com> wrote in message
news:122666DE-2AD4-43D5-8D78-F6695A6BC901@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
- Next message: Wayne Snyder: "Re: trigger question"
- Previous message: Wayne Snyder: "Re: SQL Query Performance"
- In reply to: Yog: "DB-Library error 10038"
- Next in thread: Erland Sommarskog: "Re: DB-Library error 10038"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|