Connection is busy with results for another hstmt & Win2003 SP1

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jegg

    Connection is busy with results for another hstmt & Win2003 SP1

    I wrote a web app using an ASP front end (not .NET) connecting to a SQL
    Server 2000 (no SP) back end. Both the web server and the database
    server are Windows 2003 boxes. The app was running fine two weeks ago
    before I went on vacation. While I was gone my net admin applied
    Windows 2003 SP1 to the web server. Upon my return I was informed that
    the app is no longer working, getting the following error:

    [Microsoft][ODBC SQL Server Driver]Connection is busy with results for
    another hstmt

    Since that is presumably the only thing that changed in my absence I
    believe the SP somehow messed up the way the ODBC was working. I tried
    moving the SQL Server database to a different Windows 2003 box which
    also received the SP1 update and also includes SP3 for SQL Server, but
    get the same error.

    I am hitting the database like so:

    set GetData = CreateObject("A DODB.Command")
    GetData.ActiveC onnection = SQLConn
    GetData.Command Text = "<stored procedure call>"
    Set DataRS= GetData.Execute (,,adCmdText)

    I appear to get the error when I execute the second call. I am
    learning ASP as I go, so maybe this is a trivial problem.

  • Erland Sommarskog

    #2
    Re: Connection is busy with results for another hstmt &amp; Win2003 SP1

    Jegg (jsauri@gmail.c om) writes:[color=blue]
    > I wrote a web app using an ASP front end (not .NET) connecting to a SQL
    > Server 2000 (no SP) back end. Both the web server and the database
    > server are Windows 2003 boxes. The app was running fine two weeks ago
    > before I went on vacation. While I was gone my net admin applied
    > Windows 2003 SP1 to the web server. Upon my return I was informed that
    > the app is no longer working, getting the following error:
    >
    > [Microsoft][ODBC SQL Server Driver]Connection is busy with results for
    > another hstmt
    >
    > Since that is presumably the only thing that changed in my absence I
    > believe the SP somehow messed up the way the ODBC was working. I tried
    > moving the SQL Server database to a different Windows 2003 box which
    > also received the SP1 update and also includes SP3 for SQL Server, but
    > get the same error.
    >
    > I am hitting the database like so:
    >
    > set GetData = CreateObject("A DODB.Command")
    > GetData.ActiveC onnection = SQLConn
    > GetData.Command Text = "<stored procedure call>"
    > Set DataRS= GetData.Execute (,,adCmdText)
    >
    > I appear to get the error when I execute the second call. I am
    > learning ASP as I go, so maybe this is a trivial problem.[/color]

    The gist of the error message is that you have a command that generated
    one or more results, that you have not picked up, and you cannot submit
    the next stored procedure for execution.

    If that procedure generates result sets, you probably want that data.
    Then again, it could be a stray debug result set that should not be
    there.

    Here are some general rules:
    o Unless you want explicit row counts back from INSERT/UPDAET/DELETE
    operations, submit a SET NOCOUNT ON when you connect. These rowcounts
    are actually kind of result sets, and these need to be consumed.
    SET NOCOUNT ON eliminates those.
    o If you call a stored procedure that is not supposed to return data,
    specify the option adExecuteNoReco rds.
    o When you run a procedure that can return data, be sure to get all
    record sets, by looping over .NextRecordset.

    --
    Erland Sommarskog, SQL Server MVP, esquel@sommarsk og.se

    Books Online for SQL Server SP3 at
    Get the flexibility you need to use integrated solutions, apps, and innovations in technology with your data, wherever it lives—in the cloud, on-premises, or at the edge.

    Comment

    • Jegg

      #3
      Re: Connection is busy with results for another hstmt &amp; Win2003 SP1

      Thanks for the info. I did have nocount set to on. However, I did not
      know about the adExecuteNoReco rds option. That actually will come in
      very handy.

      On a whim I did manage to elimate the error by adding "DataRS = empty"
      after the first stored procedure call. I did not have to do this with
      any of the others presumably because I loop through the result set
      until EOF (there was known to be only one possible record in the first
      result set so I did not do this).

      Thanks for your speedy reply!

      Comment

      Working...