Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning Record Set 2

Status
Not open for further replies.

TMRO

Technical User
Jan 10, 2003
140
CA
Hi guys,

I'm calling in my asp page a stored procedure with 2 parameters. Here is the code

set cn = Server.CreateObject("ADODB.Connection")
cn.CursorLocation = adUseClient
cn.Open "Provider=SQLOLEDB;Server=servername;Database=DB;UID=user;PWD=password"
set rsresults = Server.CreateObject("ADODB.RecordSet")
set cmd = Server.CreateObject("ADODB.Command")
set cmd.ActiveConnection = cn
cmd.CommandText = "sp_GetSearchCriteria"
cmd.CommandType = 4
cmd.Parameters.Append cmd.CreateParameter("@UserID",adChar,1,10,Request("UserID"))
cmd.Parameters.Append cmd.CreateParameter("@StartUp",adChar,1,10,Request("StartUp"))
set rsresults = cmd.Execute

The stored procedure (sp_GetSearchCriteria) is calling another stored procedure which returns a recordset.

Now, if I want to work with the recordset the error that I'm getting is

ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.

This is because the main stored proceudre is not returning directly a recordset?

If I run the first SP in Query Analyzer everything is fine.

Anybody some ideas?

Thank you
 
Modify your stored procedure with the code in [!]Red[/!]

Code:
Alter Procedure sp_GetSearchCriteria
  @Param1 ...,
  @Param2 ...
As
[!]SET NOCOUNT ON[/!]

   The rest of the stored procecure

-George

Strong and bitter words indicate a weak cause. - Fortune cookie wisdom
 
make sure that you have set Nocount ON and ANSI_warnings OFF

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top