Results 1 to 7 of 7
  1. #1
    Join Date
    May 2004
    Posts
    73

    Unanswered: Could someone tell me whats wrong with this code?

    I cant get this to work for some reason i am clueless, here is my code:

    And here is the error:
    //////////////////////////////////////////////////////////
    ADODB.Recordset error '800a0e79'

    Operation is not allowed when the object is open.

    /home/details.asp, line 106
    /////////////////////////////////////////////////////////

    Begin Code:

    /////////////////////////////////////////////////////////
    <%
    Color = "#05D1B8"
    rma_id = Request.QueryString("rma_id")
    SQL = "SELECT * FROM TBL_RMA WHERE RMA_ID='"&rma_id&"'"
    rs.open SQL, Conn
    If Not rs.BOF Then
    %>
    <table>
    <tr>
    <td bgcolor="<%=Color%>">RMA ID</td>
    <td bgcolor="<%=Color%>">DATE GENERATED</td>
    </tr>
    <tr>
    <td><%=rs("RMA_ID")%></td>
    <td><%=rs("RMA_DATE_GENERATED")%></td>
    </tr>
    </table>
    </br>
    <table>
    <tr>
    <td bgcolor="<%=Color%>">RMA STATUS</td>
    </tr>
    <tr>
    <td><%=rs("RMA_STATUS_ID")%></td>
    </tr>
    </table>
    <br>
    <table>
    <tr>
    <td bgcolor="<%=Color%>">PART NUMBER</td>
    <td bgcolor="<%=Color%>">DESCRIPTION</td>
    <td bgcolor="<%=Color%>">SERIAL NUMBER</td>
    </tr>
    <tr>
    <td><%=rs("RMA_PRODUCT_ID")%></td>
    <td><%=rs("RMA_PRODUCT_ID_DESCRIPTION")%></td>
    <td><%=rs("RMA_SERIAL_NUMBER")%></td>
    </tr>
    </table>
    <br>
    <table>
    <tr>
    <td bgcolor="<%=Color%>">RECEIVED DATE</td>
    <td bgcolor="<%=Color%>">PRIORITY</td>
    <td bgcolor="<%=Color%>">TRANSACTION</td>
    </tr>
    <tr>
    <td><%=rs("RMA_PRODUCT_ARRIVAL_DATE")%></td>
    <td><%=rs("RMA_PRIORITY_ID")%></td>
    <td><%=rs("RMA_TRANSACTION_TYPE_ID")%></td>
    </tr>
    </table>
    <table>
    <tr>
    <td bgcolor="<%=Color%>">PROBLEM DESCRIPTION</td>
    </tr>
    <tr>
    <td><%=rs("RMA_PROBLEM_DESCRIPTION")%></td>
    </tr>
    </table>
    <br>
    <table>
    <tr>
    <td bgcolor="<%=Color%>">TO MFG</td>
    <td bgcolor="<%=Color%>">VIA</td>
    <td bgcolor="<%=Color%>">MFG RA</td>
    </tr>
    <tr>
    <td><%=rs("RMA_TO_MFG_DATE")%></td>
    <td><%=rs("RMA_TO_MFG_VIA")%></td>
    <td><%=rs("RMA_TO_MFG_RA")%></td>
    </tr>
    <tr>
    <td bgcolor="<%=Color%>">FROM MFG</td>
    <td bgcolor="<%=Color%>">VIA</td>
    </tr>
    <tr>
    <td><%=rs("RMA_FROM_MFG_DATE")%></td>
    <td><%=rs("RMA_FROM_MFG_VIA")%></td>
    </tr>
    </table>
    <table>
    <tr>
    <td bgcolor="<%=Color%>">PROBLEM FOUND</td>
    </tr>
    <tr>
    <td><%=rs("RMA_PROBLEM_FOUND")%></td>
    </tr>
    </table>
    <%
    Else
    Response.Redirect("http://usautomatic.dyndns.org/home/failed.asp")
    End If
    If rs.EOF Then
    rs.Close
    End If
    %>
    <%
    rma_id = Request.QueryString("rma_id")
    CUSTOMER_ID = session("CUSTOMER_ID")
    SQL = "SELECT * FROM tracking_export.csv WHERE CUSTOMERID='"&CUSTOMER_ID&"' AND RMA_ID='"&rma_id&"'"
    rs.open SQL, Conn2
    If Not rs.BOF Then
    %>
    <tr>
    <td><a href="http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion=5.0&sort_by=status &tracknums_displayed=5&TypeOfInquiryNumber=T&loc=e n_US&InquiryNumber1=<%=rs("ShipmentID")%>&InquiryN umber2=&InquiryNumber3=&InquiryNumber4=&InquiryNum ber5=&AgreeToTermsAndConditions=yes&track.x=32&tra ck.y=6">Track</a></td>
    </tr>
    <%
    Else
    Response.Redirect("http://usautomatic.dyndns.org/home/failed.asp")
    End If
    If rs.EOF Then
    RS.Close
    End If
    %>
    /////////////////////////////////////////////////////////

    Any help would be appreciated.

    Thanks,
    X-Centric

  2. #2
    Join Date
    Dec 2001
    Location
    Toronto, Canada
    Posts
    335
    I think you'll need to move the rs.Close before the second rs.Open. You should always close the recordset before trying to open it on the second connection. Even if rs.BOF is false on the first open, rs is open and needs to closed before the second "rs.open SQL, Conn2"
    MCDBA

  3. #3
    Join Date
    May 2004
    Posts
    73
    Isnt that what i am doin here.

    /////////////////////////////////////////////////////
    Response.Redirect("http://usautomatic.dyndns.org/home/failed.asp")
    End If
    If rs.EOF Then<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<HERE
    rs.Close<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<HERE
    End If<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<HE RE
    %>
    <%
    rma_id = Request.QueryString("rma_id")
    CUSTOMER_ID = session("CUSTOMER_ID")
    SQL = "SELECT * FROM tracking_export.csv WHERE CUSTOMERID='"&CUSTOMER_ID&"' AND RMA_ID='"&rma_id&"'"
    rs.open SQL, Conn2
    If Not rs.BOF Then
    %>
    <tr>
    <td><a href="http://wwwapps.ups.com/WebTracking/processInputRequest?HTMLVersion=5.0&sort_by=status &tracknums_displayed=5&TypeOfInquiryNumber=T&loc=e n_US&InquiryNumber1=<%=rs("ShipmentID")%>&InquiryN umber2=&InquiryNumber3=&InquiryNumber4=&InquiryNum ber5=&AgreeToTermsAndConditions=yes&track.x=32&tra ck.y=6">Track</a></td>
    </tr>
    <%
    Else
    Response.Redirect("http://usautomatic.dyndns.org/home/failed.asp")
    End If
    If rs.EOF Then
    RS.Close
    End If
    %>
    /////////////////////////////////////////////////////////

    I am almost there, i can feel it!!!!!

  4. #4
    Join Date
    Dec 2001
    Location
    Toronto, Canada
    Posts
    335
    I don't see you doing anything with the recordset RS after you open it. So if the SELECT returns X records you check BOF and then EOF. You won't get to EOF if you don't move through the recordset. Either rs.MoveLast or just remove the "IF rs.EOF".
    MCDBA

  5. #5
    Join Date
    May 2004
    Posts
    73
    Thank you so much, you put me in the right direction. im still grasping the concept of opening/closing/looping through recordsets. So now that my recordsets are opening closing properly, what do i do about

    [Microsoft][ODBC Text Driver] Data type mismatch in criteria expression.

    when i try to use the Request.QueryString("rma_id")

    I am simply passing the rma_id which is a 4 digit number through the querystring then into the sql statement (conn2) to retrieve only that record.
    I think it has to do with being a number instead of text.?

    Your help is very much appreciated.

  6. #6
    Join Date
    Dec 2001
    Location
    Toronto, Canada
    Posts
    335
    If RMA_ID is integer then you won't need to put single quotes around rma_id
    SQL = "SELECT * FROM tracking_export.csv WHERE CUSTOMERID='"&CUSTOMER_ID&"' AND RMA_ID='"&rma_id&"'"

    Do
    SQL = "SELECT * FROM tracking_export.csv WHERE CUSTOMERID='"&CUSTOMER_ID&"' AND RMA_ID="&rma_id

    The same goes form CUSTOMERID if it is integer.

    Also run Profiler to see the exact query being executed.
    MCDBA

  7. #7
    Join Date
    May 2004
    Posts
    73
    I was just reading that somewhere when i got the reply email. you are a life saver, thank you so much. have a great weekend!

    Topic CLosed

    X-Centric

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •