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!

ASP Stored Procedure return count

Status
Not open for further replies.

kramerica

Technical User
Jun 19, 2001
74
US

I want to be able to count the number of records in a record set by passing a parameter to a stored procedure.
For Example location id 7 is going to list all users who are in the 'TZY' Office. Then I can get the count and run it against location id 23 and get a count of all users at the "RES" office.

I have a stored procedure and I can execute it from ASP but How do I get the results in ASP?! I know it sounds 'simple'.. what am I missing.


Here is my stored procedure:
===================================================
CREATE PROCEDURE myCounter
@recordid int,
@nRecordCount int
as

Select @nRecordCount = COUNT(*)
FROM tblusers Where [_location]=@Recordid
GO
====================================================

In ASP I can execute the parameter.. I just can't get the total back because I am unfamiliar with the syntax.

---------------------------------------------------

strConn = Session("dbConn")
set xConn = Server.CreateObject("ADODB.Connection")
xConn.Open strConn
Set rs=xconn.execute("myCounter " & 1)
---------------------------------------------------
How can I get the ASP code to return the count value of the sql stored procedure?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top