Re: DB-Library error 10038

From: Aaron Collver (aaron_collver_at_yahoo.com)
Date: 05/19/04


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



Relevant Pages

  • Re: TCP listener
    ... This loop is required because of the main purpose of the program I am trying ... I am using the push server product's .Net sample and trying to modify it ... that it only works untill I close connection to the c# listener. ... private volatile bool monitorPort = true; ...
    (microsoft.public.dotnet.languages.csharp)
  • SSIS - Error Messages when looping through Excel Files
    ... What's the trick to use a Foreach File in Folder loop when looping through ... Now if I have my XL Connection manager set to a specific file, ...
    (microsoft.public.sqlserver.dts)
  • Re: Changing connection information on OLEDB connection
    ... What I would do is set a breakpoint on the "On Each Iteration Of The Loop" event. ... I would then set a watch on the variable to make sure that the connection string is being set properly. ... When I run the package, I just get the first server's data twice, it ... but the second loop around it doesn't seem to be working. ...
    (microsoft.public.sqlserver.dts)
  • Re: Changing connection information on OLEDB connection
    ... Sybase OLEDB datasources, it seems to cache one connection so, even ... Loop" event. ... but the second loop around it doesn't seem to be working. ...
    (microsoft.public.sqlserver.dts)
  • Re: Changing connection information on OLEDB connection
    ... You can set the password property of an OLEDB connection with an ... You can set all connection properties ... Loop" event. ... but the second loop around it doesn't seem to be working. ...
    (microsoft.public.sqlserver.dts)