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

SqlDataSource set programmatically asp MVC

4 Answers 360 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
KAMIL
Top achievements
Rank 1
KAMIL asked on 08 Oct 2014, 06:42 PM
Hey,

I'm trying to find way how to set up datasource connection string programmatically. I have report .trdx created (works for hardcoded connection string) and I have few of mysql databases with the same structure. I need ability to set connection string each time before run report. Is there any way to do this for web application? Im trying with deserialization of report and set connection but i can't see any way to pass Report object into report view.

4 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 10 Oct 2014, 11:25 AM
Hi Kamil,

Please test using the approach suggested in the Changing the connection string dynamically according to runtime data KB article. Notice that Telerik.Reporting.Report objects are passed to viewers/ReportProcessor via an InstanceReportSource. For more details, please refer to the Report Sources article.


I hope the above information is helpful.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Aseman
Top achievements
Rank 1
Veteran
answered on 29 Jun 2020, 03:10 PM

Hi

in this sample we have got sqlDataSource by filling connection string ,....

     How Can I Fill sqlDataSource by Datatable and without connection string??

since my start up project has connection string in its config File and I can not use the connection string again in another project because of this Error

"an error has occurred while processing table 'crosstab 1' .....  format of the initialization string does not conform to specification starting at index 0"

I have My Datatable which I need. 

MyReport report = new MyReport();
string selectCommand = @"SELECT * FROM Sales.Store";
string connectionString = "Data Source=(local)\\SQLEXPRESS;Initial Catalog=AdventureWorks;Integrated Security=True";
Telerik.Reporting.SqlDataSource sqlDataSource = new Telerik.Reporting.SqlDataSource(connectionString, selectCommand);
report.DataSource = sqlDataSource;
0
Aseman
Top achievements
Rank 1
Veteran
answered on 09 Jul 2020, 04:48 PM
please help ,10 days passed,anybody knows?
0
Nasko
Telerik team
answered on 14 Jul 2020, 03:12 PM

Hello Aseman,

Check this stackoverflow thread with information on the error message.

Regards,
Nasko
Progress Telerik

Tags
General Discussions
Asked by
KAMIL
Top achievements
Rank 1
Answers by
Stef
Telerik team
Aseman
Top achievements
Rank 1
Veteran
Nasko
Telerik team
Share this question
or