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

How to add a datasource to Telerik report using a console application

2 Answers 175 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ismail
Top achievements
Rank 1
Ismail asked on 04 Jun 2014, 08:19 AM
Hi 

I currently have a web application that shows a telerik report.
The report works fine

I needed the reports to be mailed daily at a certain time to relevant people so i created a mailer in a console app that runs at a certain time.

The code i used is below

Dim reportProcessor As New Telerik.Reporting.Processing.ReportProcessor()
            Dim oreport As New cReportLibrary.report
            oreport.ReportParameters.Item("par1").Value = "111"
            Dim Result As RenderingResult = reportProcessor.RenderReport("PDF", oreport, Nothing)
            Dim ms As New MemoryStream(Result.DocumentBytes)
            ms.position = 0


The email sends perfectly fine problem i am having is when i open up the PDF in the email  i get the following error
An error has occurred while processing Report 'CustProfile':

Unable to establish a connection to the database. Please, verify that your connection string is valid. In case you use a named connection string from present in the configuration file of your application.
------------- InnerException -------------
Format of the initialization string does not conform to specification starting at index 0.

How could i add the datasource in my console app that telerik will be able to refrence and send the report without an error

2 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 04 Jun 2014, 03:24 PM
Hello Ismail,

In order to provide support for connection string reusing and to enable the usage of different connection string while designing the reports and deploying them we provide an option in the SqlDataSource Wizard to save the connection string in the application configuration file (app.config). If you have selected this option the connection string is no more kept in the report definition. The report definition only keeps the connection string name. This name is then used by the reporting engine to retrieve the connection string from the hosted application configuration file. In this line of thoughts our suggestion is to add the appropriate connection string in your application configuration file (app.config). 

Regards,
Peter
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
Ismail
Top achievements
Rank 1
answered on 05 Jun 2014, 05:59 AM
Hi Peter

Thanks for the response.
I realized after some time i should add the Connection string to the app.config file and that had worked
Tags
General Discussions
Asked by
Ismail
Top achievements
Rank 1
Answers by
Peter
Telerik team
Ismail
Top achievements
Rank 1
Share this question
or