471,354 Members | 1,005 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

asp page gets an empty recordset from a sql server store procedure

Hello everyone,
I have a web application written in asp 6.0, my problem is that I execute a sql server store procedure and I get an empty recordset, while executing the same sp on query anlyzer I can see 5 records.
Basically the sp create a temp table, populate it, and lastly selects the results from the temp table.
I read on a preceding post to insert the clause: "SET NOCOUNT ON" to avoid getting closed recordset of the insert statements, so I did it.
The query analyzer results changed, (I didn't see the number of rows created any more) But it didn't change the result on the asp page: I still get an empty recordset.
the snippet asp code is the following:
Expand|Select|Wrap|Line Numbers
  1.    dim cmd 
  2.    dim rs
  4.    set cmd = server.createobject("adodb.command")
  5.    set rs = server.CreateObject("adodb.recordset")
  7.    cmd.commandtext = "mywonderfulstoreprocedure"
  8.    cmd.commandtype = adcmdstoredproc
  9.    cmd.activeconnection = cnapp 'assume that's a succesful connection
  11.    cmd.Parameters("@month") = 3
  12.    cmd.Parameters("@year") = 2007
  14.    rs.open cmd
  15.    if rs.EOF then
  17.         Response.Write "recordset empty"
  18.    else
  19.         Response.Write "recordset full of stuff"
  20.    end if
Eventually it's important to point out that the same code arranged for visual basic 6.0 works perfectly, giving back the recordset full of data

Thank you for your help in advance,
Nov 14 '07 #1
4 2437
I forgot to say that we use windows 2000 Service Pack 4.
Any help would be very appreciated!
Nov 15 '07 #2
3,406 Expert 2GB
Hello everyone,
I have a web application written in asp 6.0,
There is no ASP 6.0. It only got up to 3.0 before M$ abandoned it.

Do you have some sort of error handler running?

Nov 17 '07 #3
thank you for your help.
You are absolutely right, it's asp 3.0
As for error handler I test with
if err.number <> 0 then ...
but this test is not passed.

The test passed is rs.EOF, that comes true (I don't know why)

Thank you again.
Nov 19 '07 #4
3,406 Expert 2GB

I personally don't like to use stored procedures, I prefer to do the programming in the script and just send very basic queries to the db, but I'll try to help.

if you take out the 'on error' line what error do you get?

Nov 19 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Rod Snyder | last post: by
6 posts views Thread by scottyman | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.