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

ReportViewer in a Webpage

3 Answers 145 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Robert Canal
Top achievements
Rank 1
Robert Canal asked on 17 Jun 2010, 09:18 PM
I have successfully made the report as a classlibrary in the website structure.  Now I am trying to get the viewer to display it in an aspx page.  I have add the classlibrary in the references, and was able to set the reportviewer properties to point to the report in the class.  However when I execute the asp page I am getting an error.

"An error has occurred while processing Report": Unable to connect to database. Please verify that your connection string is valid; in case you use a connection string from the application configuration file, make sure the name is correct and the connection string settings are present in the configuration file of your application."

I can open the Report in the classlibrary and preview the data so I know the connection is good.  Do I have to declare the connection in the Web.Config file?  Currently I set the SQLconnection1 for the report.

Thanks

3 Answers, 1 is accepted

Sort by
0
Robert Canal
Top achievements
Rank 1
answered on 18 Jun 2010, 02:39 AM
Fixed the issue...Apparently when using the wizard to create the report it sets the ConnectionString in the SqlDataSource to "ClassLibrary1.Properties.Settings.XXX" but when the asp page tries to execute the ReportViewer it doesn't know what that connection is.  So I had to change it to a raw connection string in the SqlDataSource to "Data Source=Server;Initial Catalog=Database;Persist Security Info=True;User ID=Username;Password=Password" that way the webpage new how to connect to the database.
0
Y L
Top achievements
Rank 1
answered on 27 Sep 2010, 05:59 PM
Thank you very much for sharing the solution ! I solved my problem too ^_^
0
Accepted
Steve
Telerik team
answered on 28 Sep 2010, 08:35 AM
Hi guys,

The straight-forward solution to this is just like the message you received says: copy the connectionString from the report library app.config to the config file of your application (web.config for web site/app or app.config for Windows Forms/WPF app).

Regards,
Steve
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Robert Canal
Top achievements
Rank 1
Answers by
Robert Canal
Top achievements
Rank 1
Y L
Top achievements
Rank 1
Steve
Telerik team
Share this question
or