problem with recordset state

M

meg

Hi, I have a page that loads 2 calendars from which the user chooses a starting date and an ending date; on
click of the submit button those values are used in a query to return a small resultset on the same page. On
the line where I validate whether the recordset is BOF or EOF I get this error:
ADODB Recordset Error
Operation is not allowed when the object is closed.

Even right after the line where I open the recordset I check its state and it says 0. I can't see what i'm
doing wrong. I thought maybe it was something to do with opening the results in the same page, so I created a
test page to send the results there, just to see if it would work, it still doesn't work however I get a
different error and it's on the line where I open the recordset:

ADODB Recordset Error
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

This is my code and some more explanation:

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open sConStr

If Request.QueryString("Action")="Go" Then
sStartDate = Request.QueryString("StartDate")
sEndDate = Request.QueryString("EndDate")
sExec = "Exec GetResults '" & sStartDate & "', '" & sEndDate & "'" '--THIS WORKS WHEN PASTED IN QUERY
ANALYZER
Set oResultsRs = Server.CreateObject("ADODB.Recordset")
oResultsRs.Open sExec, oConn '--ERRORS HERE WHEN ACTION GOES TO TEST PAGE
If Not(oResultsRs.BOF OR oResultsRs.EOF) Then%> '--ERRORS HERE WHEN ACTION GOES TO SAME PAGE
....the rest of the code builds the table, etc.

Any help would be appreciated - let me know if you need more info.
Thanks!
 
M

meg

I got it.


Hi, I have a page that loads 2 calendars from which the user chooses a starting date and an ending date; on
click of the submit button those values are used in a query to return a small resultset on the same page. On
the line where I validate whether the recordset is BOF or EOF I get this error:
ADODB Recordset Error
Operation is not allowed when the object is closed.

Even right after the line where I open the recordset I check its state and it says 0. I can't see what i'm
doing wrong. I thought maybe it was something to do with opening the results in the same page, so I created a
test page to send the results there, just to see if it would work, it still doesn't work however I get a
different error and it's on the line where I open the recordset:

ADODB Recordset Error
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

This is my code and some more explanation:

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open sConStr

If Request.QueryString("Action")="Go" Then
sStartDate = Request.QueryString("StartDate")
sEndDate = Request.QueryString("EndDate")
sExec = "Exec GetResults '" & sStartDate & "', '" & sEndDate & "'" '--THIS WORKS WHEN PASTED IN QUERY
ANALYZER
Set oResultsRs = Server.CreateObject("ADODB.Recordset")
oResultsRs.Open sExec, oConn '--ERRORS HERE WHEN ACTION GOES TO TEST PAGE
If Not(oResultsRs.BOF OR oResultsRs.EOF) Then%> '--ERRORS HERE WHEN ACTION GOES TO SAME PAGE
....the rest of the code builds the table, etc.

Any help would be appreciated - let me know if you need more info.
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top