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

Silverlight Report Viewer is "unable to establish a connection to the database"

5 Answers 105 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 1
Mike asked on 10 Feb 2012, 05:34 PM
I can view preview the report just fine in the preview tab of the designer for the report. But I get an error when the report viewer tries to load the specified report. I suspect that it has to do with the Report Server or Service in some way. When I set a break point at the point where the Report Viewer has been made I can see that the ReportServiceURI property of the Report Viewer has no real data associated with it. The properties of the ReportServiceURI and the ReportServerURI(ie Absolute Path, Absolute URI, Local Path, and anything that doesn't have a value of true, false, or an enum) all say that they threw an invalid operation exception. Is this normal?

I've been trying to figure this out for a while now and have seen many other forum posts and tried many things to fix this to no avail.

Some more info:
I'm using an Entity Data Model so the connection string is a little different than the other methods of connecting to data. I copied this connection string straight from the Web.Config file of the Web project of my silverlight application, which is where the data model is. If the preview works like it should(showing correct data from the data model) does this mean my connection string is correct and working?

The preview in the designer doesn't work (nor can I find data objects to use) when the connection string is messed up.

What are some of the things that could cause the Report to show correct data in the preview at design time, but not at execution time? How can I verify that my Report Service is working correctly for the client side connection to the entity model?

Any other information you need from me I'd be happy to provide.

5 Answers, 1 is accepted

Sort by
0
Mike
Top achievements
Rank 1
answered on 10 Feb 2012, 05:38 PM
Here's a screenshot of the error as I see it in the report viewer embedded in my silverlight website.
0
Steve
Telerik team
answered on 11 Feb 2012, 04:49 PM
Hello Mike,

It is not clear how you bind the report. We have an EntityDataSource Component that is designed specifically to bind to ADO.NET Entity Data Model.
For more information refer to:
In order to use the Report Designer and Report Wizard i.e. have your data available in the report designer, the Entity Data Model should be located in a separate project. The connectionString to the database should be copied to the config file of the reports project for the Data Explorer and Preview to work. Any extension methods should be located in the same project as the model.

Greetings,
Steve
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Mike
Top achievements
Rank 1
answered on 13 Feb 2012, 04:23 PM
Thanks Steve,

That is indeed how I am binding to the Model. Let me try and give you an idea of how I went about doing this.

I've been given the task of adding Reports into an already existing silverlight project. This pre-existing silverlight project has it's model in the "Web" project. When you make a silverlight project in VS2010 there are two projects that are made for you. The "web" project is the server side stuff and the other project is the client side code.

So what I did was add a "class library" project for my Reports project. I then added a report service to the Web project and added some references to both of the other projects. I also copied the connection string from the Web.config file I had in my Web project. Then I used the Report Wizard to make a report in this new class library. I pretty much exactly did what this video did except I had a pre-existing silverlight project and I had to use a pre-existing Model.

Everything went well, until I ran the project and opened up the ReportViewer. What I got was that error I described earlier, instead of what I saw in the preview of the Report Designer. What could have gone wrong? Is there anything in that video that is missing that I should do (besides referring to the the data.entity dll)?
0
Steve
Telerik team
answered on 16 Feb 2012, 01:23 PM
Hello Mike,

Making sure the connectionString from the app.config of your class library is copied to the web.config of your web application is the only thing you need to do i.e. you use the same connectionString you have defined in your class library when binding the reports to data in the web application. Our data source components look for the name of the connectionString, so check if that is correct.

Regards,
Steve
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Mike
Top achievements
Rank 1
answered on 21 Feb 2012, 05:28 PM
I checked to see if the connection string was correct, it was. If I changed it to something I knew was wrong, then the designer wouldn't be able to find data objects on the named connection.

Anyway, I've abandoned the effort of fixing this. My co-worker got it to work in a different way. He put the reports in the same project as the data model, added references to the assemblies for reporting, and used the same reporting service. Somehow this worked.

I wish that I knew putting the report in the same project as the data model was possible. I assumed it wasn't because all the instructions I found said to put the reports in a separate class library.
Tags
General Discussions
Asked by
Mike
Top achievements
Rank 1
Answers by
Mike
Top achievements
Rank 1
Steve
Telerik team
Share this question
or