Stored Procedures with Multiple Result Sets

Stimulsoft Reports.NET discussion
Post Reply
ColinDaly
Posts: 7
Joined: Fri Nov 11, 2011 3:44 am

Stored Procedures with Multiple Result Sets

Post by ColinDaly »

Hi,

We have a number of reports which need to be based on stored procedures that return multiple results sets i.e.

Code: Select all


CREATE PROCEDURE [dbo].[spxMultipleResultSets] 
	@intID INT = NULL
AS
BEGIN

	SELECT
		ta.*
	FROM
		[TableA] AS ta
		
	SELECT
		tb.*
	FROM
		[TableB] AS tb

END

Can you please advise on how we may achieve this using the Stimulsoft Designer as at present only the first result set (TableA) is available.

Regards,

Colin
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Stored Procedures with Multiple Result Sets

Post by Alex K. »

Hello,

As a way, you can try to use the LINQ to SQL.
Topic on msdn: http://msdn.microsoft.com/en-en/library ... S.90).aspx

Either divide the procedure into two ones or get data in the code and send them to your report.

Thank you.
ColinDaly
Posts: 7
Joined: Fri Nov 11, 2011 3:44 am

Stored Procedures with Multiple Result Sets

Post by ColinDaly »

Hi,

Thank you for the response. Unfortunately LINQ to SQL is not an option we can consider.

Please could you provide an example of how we would set the data from code as this may be an option we could consider. I presume this would be using a DataSet?

Regards,

Colin
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Stored Procedures with Multiple Result Sets

Post by Alex K. »

Hello,

Please try to use the following code:

Code: Select all

SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "SomeResultSets";

SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);

StiReport report = new StiReport();
report.RegData(ds);
report.Design();
Thank you.
Post Reply