Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 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 October 12th, 2009, 05:51 AM
Authorized User
 
Join Date: Jul 2009
Posts: 20
Thanks: 0
Thanked 1 Time in 1 Post
Default Retrieving a result set from stored procedure

Hallo everybody,

I wrote a stored procedure that executes on the MS-SQL Server.

I would like to store the returned set of attributes in a variable that I can retrieve in my C# application. The procedure code looks like this:

CREATE PROCEDURE Select_InnerJoin_Memo
AS
SELECT Memo.Title, Memo.Body, Status.Status, Users.UserName AS
Author FROM Memo INNER JOIN Users ON Memo.MadeBy = Users.Id INNER JOIN Status ON Memo.Status = Status.Id
GO
EXECUTE Select_InnerJoin_Memo

The procedure returns the required results on the server but now I would like to get the returning attributes into a table variable so I can later use it in C# and fill a DataGridView. I allready declared a table variable like:

DECLARE @ResultSet TABLE
(
Title char(50),
Body char(50),
...
)

and put the '@ResultSet' = after the SELECT keyword but with no success .


Any help?

Thank you
 
Old October 12th, 2009, 08:11 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

Please check the following tutorials:

Walkthrough: Displaying Data Using a Stored Procedure in the GridView Web Server Control
http://msdn.microsoft.com/en-us/libr...y1(VS.80).aspx

How to display data using the .NET GridView Control, stored procedures, ASP.NET 2.0 and VB.NET
http://www.aspnettutorials.com/tutor...spnet2-vb.aspx
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
 
Old October 12th, 2009, 10:45 AM
Authorized User
 
Join Date: Jul 2009
Posts: 20
Thanks: 0
Thanked 1 Time in 1 Post
Default Thank you

That's it !
Thank you very much.





Similar Threads
Thread Thread Starter Forum Replies Last Post
result set rajesh_css SQL Language 2 May 18th, 2009 03:33 PM
Empty result set from mysql stored procedure talz13 PHP Databases 3 December 28th, 2008 05:58 PM
stored procedure with two result sets joxa83 SQL Server 2000 14 July 18th, 2007 01:03 AM
How to set Oracle Stored Procedure Timeout jcslam Oracle 0 October 18th, 2004 03:38 AM
Result set jemacc SQL Server 2000 0 December 19th, 2003 07:26 PM





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