Solved

Connection is busy with results for another command

Posted on 2006-07-24
3
604 Views
Last Modified: 2008-03-10
Experts,

Please help ASAP.  Here is my code.  How can I get rid of Connection is busy with results for another command error?

Please edit the code:
Set oRs4 = Server.CreateObject("ADODB.Recordset")
sqlStmt = "SELECT * from CLF_Sample_Hazards where SampleID = 0"
      oRs4.Open sqlStmt, oConn, 1, 3
      Set oRs5 = Server.CreateObject("ADODB.Recordset")
                  
      buff = ""
      j=0
      if Request.form("hazard"&i) <>"" then
            buff = Request.form("hazard"&i)
            options = Split(buff, " ")
                                                      
            For j=0 to UBound(options) - 1
                          if trim(options(j)) <>"" then
            sqlStmt = "SELECT * from CLF_Hazards where HazardDescription like '" &trim(options(j))&"%'"
            Set oRs5 = oConn.Execute(sqlStmt)
            if oRs5.BOF=false then oRs5.MoveFirst
                                          
            if not oRs5.EOF then
                                          
            oRs4.AddNew
            oRs4("SampleID")=  CreateSample
            if oRs5("hazardID") <>"" then oRs4("HazardID")=  oRs5("hazardID")
            oRs4("requestID") = create
            oRs4.Update '<----------------ERROR Connection is busy with results for another command
                                                
            end if
                                                
      end if
                                                
      next
                              
end if

0
Comment
Question by:suran78
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
jrram earned 500 total points
ID: 17168203
Are CreateSample and create functions?

And try taking out this

=============

Set oRs4 = Server.CreateObject("ADODB.Recordset")
sqlStmt = "SELECT * from CLF_Sample_Hazards where SampleID = 0"
oRs4.Open sqlStmt, oConn, 1, 3
Set oRs5 = Server.CreateObject("ADODB.Recordset")

=============

Just run this:

buff = ""
j=0
     
if Request.form("hazard"&i) <>"" then
      buff = Request.form("hazard"&i)
      options = Split(buff, " ")
                                             
      For j=0 to UBound(options) - 1
                         
            if trim(options(j)) <>"" then
         
                  sqlStmt = "SELECT * from CLF_Hazards where HazardDescription like '" &trim(options(j))&"%'"
                      Set oRs5 = oConn.Execute(sqlStmt)

                                   
                      if not (oRs5.BOF And oRs5.EOF) then

                        if oRs5("hazardID") <>"" then nHazard =  oRs5("hazardID")
                                   
                            insertSQL = "INSERT INTO TABLE(sampleID, hazardID, requestID) VALUES (" & CreateSample & "," & hazard & "," & requestID & ")"
                        oConn.Execute insertSQL

                        insertSQL = ""
                                       
                      end if
                                       
                 end if
                                       
     next
                         
end if
0
 

Author Comment

by:suran78
ID: 17168336
I changed to your code, but now I am getting a diffrent error:

Microsoft OLE DB Provider for SQL Server error '80004005'

Cannot create new connection because in manual or distributed transaction mode.

 insertSQL = "INSERT INTO CLF_Sample_Hazards(sampleID, hazardID, requestID) VALUES (" & CreateSample & "," & nhazard & "," & create & ")"
                    oConn.Execute insertSQL <------------ERROR
0
 

Author Comment

by:suran78
ID: 17168615
I forgot Createsample are not functions:

Set oRs3 = Server.CreateObject("ADODB.Recordset")
      sqlStmt = "SELECT * from CLF_Samples where SampleID = 0"
      oRs3.Open sqlStmt, oConn, 1, 3   ' adKeySet, adLockOptimistic
            for i=1 to nPropertyData
            CreateSample = 0
            oRs3.AddNew
if Request.form("SampleName"&i) <>"" then oRs3("SampleName")=  Request.form("SampleName"&i)'
if Request.form("chkMat"&i) <>"" then oRs3("UnknownMaterial")= Request.form("chkMat"&i)
if Request.form("SampleID"&i) <>"" then oRs3("SampleShippingID")= Request.form("SampleID"&i)
if Request.form("Otherhazard"&i) <>"" then oRs3("SampleSpecificHazard")= Request.form("Otherhazard"&i)
if Request.form("Otherhandle"&i) <>"" then oRs3("SampleSpecificHandling")= Request.form("Otherhandle"&i)
if Request.form("Samplename"&i) <>"" then oRs3("RequestID")= Create
                        
            oRs3.Update
            CreateSample = oRs3("sampleID")
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question