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

Use multiple SqlDataSources on a single report

1 Answer 75 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Enrique
Top achievements
Rank 1
Enrique asked on 28 Oct 2015, 10:41 PM

I'm trying to use two sqlDataSources on a single report.

 So farI have this piece of code where the Datasource is binded to the first sqlDataSource.

 

01.this.sqlDataSource1.ConnectionString = this.SqlConnectionString;
02.this.sqlDataSource1.CommandTimeout = 600;
03.this.sqlDataSource1.Parameters.Clear();
04.this.sqlDataSource1.Parameters.AddRange(new Telerik.Reporting.SqlDataSourceParameter[] {
05.                new Telerik.Reporting.SqlDataSourceParameter(StandardParams.varKey, System.Data.DbType.Int32, _varKey),
06.                new Telerik.Reporting.SqlDataSourceParameter(StandardParams.IncludeZeroBalance, System.Data.DbType.Boolean, false)
07.            });
08.this.sqlDataSource3.ConnectionString = this.SqlConnectionString;
09.this.sqlDataSource3.CommandTimeout = 600;
10.this.sqlDataSource3.Parameters.Clear();
11.this.sqlDataSource3.Parameters.AddRange(new Telerik.Reporting.SqlDataSourceParameter[] {
12.                new Telerik.Reporting.SqlDataSourceParameter(StandardParams.varKey, System.Data.DbType.Int32, _varKey)
13.            });
14.this.DataSource = sqlDataSource1;

 

I want to know if there is a way in order to tell the report that whenever I set the value of an htmlTextBox I can use the sqlDataSource other than the one set on this.DataSource.

 

Thanks.

1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 30 Oct 2015, 03:35 PM
Hello Enrique,

A single data item can have and work with the fields of only one data source. If you need to visualize data from other data source, you can use a nested data item like a Table item.

Other approach is to create a custom function accessing the second data source and retrieving the required value. The function can be used in an expression set as a Value property of a TextBox, HtmlTextBox item.


Let us know if you have any further questions.

Regards,
Stef
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Enrique
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or