Page 1 of 1

Stored Procedures with Multiple Result Sets

Posted: Fri Nov 11, 2011 3:53 am
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

Stored Procedures with Multiple Result Sets

Posted: Mon Nov 14, 2011 1:15 am
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.

Stored Procedures with Multiple Result Sets

Posted: Mon Nov 14, 2011 3:40 am
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

Stored Procedures with Multiple Result Sets

Posted: Tue Nov 15, 2011 4:39 am
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.