Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
| Search | Today's Posts | Mark Forums Read
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 13th, 2006, 11:02 AM
Registered User
Join Date: Sep 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Returning Values from a Stored Procedure


I was wondering whether someone could provide a little assistance. I am pretty familiar with SQL and ASP.NET2 and how to return columns from a stored procedure to my ASP.NET2 pages.

But how would I return values produced from functions such as COUNT() within a stored procedure? e.g.

FROM Store_Information
Many thanks

Old September 13th, 2006, 12:08 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons

if you run the stored procedure through query analyzer you will notice that a column is returned from the Count function.

What you would do is populate a datatable with the results of the stored procedure, and to access the value in your example you would do:


Alternatively you can also use Output parameters in a stored procedure which is a little less cumbersome.

"The one language all programmers understand is profanity."

Similar Threads
Thread Thread Starter Forum Replies Last Post
Returning a value (stored procedure scandalous ASP.NET 2.0 Basics 9 November 7th, 2007 03:41 PM
Returning Stored Procedure Results from ASP page JennaAckerson Classic ASP Basics 0 December 23rd, 2005 11:44 AM
Problems returning count in Stored Procedure planza SQL Language 1 December 21st, 2005 03:24 PM
Stored Proceedure Returning A Recordset rodmcleay C# 3 July 5th, 2004 09:53 PM
Returning record in stored function with ADO nmbarbillo Oracle 0 June 15th, 2004 12:36 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.