Hi all. I've got a report in RS2005 where I am trying to be able to change the database it runs against based on a parameter. I started by making the report and having this as my connect string in the dataset:
="data source=MyServer; initial catalog=DataYear2005"
I was able to connect and preview the report with no problems. I checked the forum and found out that to make it dynamic, I should be able to just add a parameter to the above definition. I set up the parameter as a string with a default value of 2005 and then changed the connect string to be:
="data source=MyServer; initial catalog=DataYear"+Trim(Parameters!sSession.Value)
When I preview this, I get the error: "Error durring processing of the ConnectString expression of datasource MyDatasource."
I'm working in the VS.Net 2005 environment that gets installed with the SQL Server 2005 tools and running against a SQL Server 2000 server. Any help would be apprieciated.
Suggestion: change the connection string back so that the report is working again. Then add a textbox in the report that uses the same expression as your planned dynamic connection string expression. Make sure the expression works in that report textbox. I think there may be type conversion problems with the expression or the name of the report parameter is not correct (case-sensitive!). You may also want to try:
="data source=MyServer; initial catalog=DataYear" & Trim(CStr(Parameters!sSession.Value))
-- Robert
|||Robert,
I tried your ideas and it is still not working. I set up the text box with the expression and I also made one with the connect string without the parameter. The data in both text boxes was identical. I then added the CStr function with no improvements. I also verified that the case was correct and it was. Any other ideas?
Thanks.
|||Do you have any parameters that are query based and rely on this connection string?
-Lukasz
This posting is provided "AS IS" with no warranties, and confers no rights.
No comments:
Post a Comment