This is a migrated thread and some comments may be shown as answers.

Can multiple data source be used in the same report?

2 Answers 3041 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
.net dev
Top achievements
Rank 1
.net dev asked on 06 May 2015, 08:47 PM

I want to use two different record sets in the same report.  They will be in their own details section, assuming two details sections can be used. 

I've created two data sources in my report project, tested both connections and verified they do return the data I need.  I don't understand how to use them though.  I expected to see both of them listed in the Date Explorer, but only one is shown there.  They both show up at design time in the pane below the report designer though.  

Please see the attached file with screen shots.  One is of the two data sources in the project while the other shows only one data source in the data explorer.

Can two data sources be used in the same project as described?

How should this be done?

 

 

2 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 08 May 2015, 09:25 AM
Hello,

There can be only a single detail section inside the report. The report can only have a single data source. In order to use the second data source created in the report you will need to add a new data item and assign the data source to its DataSource property. For more information on the topic, please refer to the Data Items and Binding a Data item to Data help articles.

The data fields from the second data source will be shown in the Data Explorer when you select the data item bound to that data source in the report designer.

Regards,
Nasko
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
0
n/a
Top achievements
Rank 1
answered on 25 Jun 2019, 04:04 AM

Hi,

I was developing a report that needed 2 sqldatasources one for buy transaction and another for sell

I successfully added both data sources to the report and this is how I set in the back

 

            Telerik.Reporting.Processing.Report report = (Telerik.Reporting.Processing.Report)sender;
            //dataSource1.CommandTimeout = 0;
            this.sqlDataSourceBuy.Parameters[0].Value = report.Parameters["emp_id"].Value;
            this.sqlDataSourceSell.Parameters[0].Value = report.Parameters["emp_id"].Value;
            this.sqlDataSourceBuy.Parameters[1].Value = report.Parameters["dateFrom"].Value;
            this.sqlDataSourceSell.Parameters[1].Value = report.Parameters["dateFrom"].Value;
            this.sqlDataSourceBuy.Parameters[2].Value = report.Parameters["dateTo"].Value;
           this.sqlDataSourceSell.Parameters[2].Value = report.Parameters["dateTo"].Value;
           // report.DataSource = sqlDataSourceBuy; uncommenting these 2 line did not break the report but did not need them
           // report.DataSource = sqlDataSourceSell;

 

 

 

Tags
General Discussions
Asked by
.net dev
Top achievements
Rank 1
Answers by
Nasko
Telerik team
n/a
Top achievements
Rank 1
Share this question
or