Search code examples
crystal-reports

How To Add More Than 1 Select Sections as DataSource in Crystal Report


As below procedure it has two select sections (type=1 and type=2). I am binding Crystal Report with this procedure. Both the sections has to bind to report. type=1 gives multiple rows & type=2 gives single row. First i have to bind report with type=2 then with type=1 on same report. But on selecting this procedure as DataSource in Crystal Report it is picking only type=1 select method as DataSource. How should I include both types in procedure as DataSource in Report? I am using CrystalReport in VS2008.

ALTER procedure [dbo].[usp_report]
 @applicationno varchar(20)=null,
 @sessionyr varchar(10)=null,
 @type int=null
as
BEGIN
     
     if(@type=1)
       begin
                /* Select Statement Goes Here */
       end    
    if(@type=2)
       begin
                /* Select Statement Goes Here */
       end
               
END

Solution

  • It's not possible to use more than one resultset from a stored proc in Crystal. You could adjust your proc, so that it delivers same columns for both types (and fill only the used ones, of course).