Operation is not allowed when the object is closed

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

    Operation is not allowed when the object is closed

    I keep getting this error whenever I try to run the following code (the
    connection string is global and declared at the top of the page) :

    <%
    Option Explicit
    Dim strConnection
    %>

    <!--#include file="include_c onnection.asp"-->

    dim andList
    dim rsSearch
    dim rsSQL

    set rsSearch = CreateObject("A DODB.Recordset" )

    '==== select a LOAD ID subset it required
    andList = ""

    '==== select a companyname subset it required
    if (len(Request("n ame"))>0) then
    andList = andList & " AND c.[name] like '%" &
    replace(Request ("name"),"'","' '") & "%' " & vbcrlf
    end if

    '==== select a contactname subset it required
    if Request("contac tName") "" then
    andList = andList & " AND co.contactname like '%" &
    Request("contac tname") & "%' " & vbcrlf
    end if

    if (andList <"") then
    rsSQL = "exec GetEmailCompany List @pUserKey = '"&lintUserKey& "' ,
    @pAndList = '"&replace(andL ist,"'","''")&" '"
    else
    rsSQL = "exec GetEmailCompany List @pUserKey = '"&lintUserKey& "'"
    end if

    '==set page size and cursor position
    rsSearch.PageSi ze = 100
    rsSearch.Cursor Location = adUseClient

    rsSearch.Open rsSQL, strConnection

    'If rsSearch.State = adStateOpen then
    ' response.write rsSQL & " - Open"
    ' Response.end
    'else
    ' response.write rsSQL & " - Closed"
    ' Response.end
    'end if

    if (rsSearch.EOF) then
    Response.Write "<P align=center><f ont size=2 color=000000><B >No
    Companies Found"
    Response.end
    end if

    I get the error on the line 'if (rsSearch.EOF) then' and only when I
    pass a value for name or contactname.



    *** Sent via Developersdex http://www.developersdex.com ***
Working...