0
votes

before going to problem let me clear that i know there are similar questions ask before but could not find the answer of my problem. my problem is:
I want to select the Data Source at runtime. First of all, i simply create a report by making a shared data source. then i create a data set using this data source. I run the report and it is working perfectly. Then I create two parameters, one for data source and one for data set. both parameters are type of "Text", their parameter visibility is "Visible" and their Available and Default values are "None". Then I created a second data source which is embedded and its connection string is :
="Data Source=" & Parameters!DataSource.Value & ";Initial Catalog=" & Parameters!DataSet.Value
Now when I click on test connection button it shows me error :
"The ConnectionString property has not been initialized."
Now can any one please explain me how to handle it. my credentials are correct. I test credentials by making embedded data source and hard codded connection string its working fine but not with dynamic connection string.

1
Have you tried to display the ConnectionString in a textbox to ensure it is ok?Sébastien Sevrin
@SébastienSevrin Sorry, I cant under stand your question. I mean how to do this? actually i'm new in reporting and i don't know much. I just read some article on dynamic data source and perform stepsHamza
Ijust wanted to know if you tried adding a textbox to your report, with the ConnectionString expression (="Data Source=" & Parameters!DataSource.Value & ";Initial Catalog=" & Parameters!DataSet.Value), to be sure your ConnectionString is what you expect it to be.Sébastien Sevrin
after reading your comment i insert a textbox in my report a write my connection string in its expression. when i run it displayed the connection string but in place of both parameters values it is showing the parameter that i have entered for data source. i mean i have entered "DataSource1" and "DataSet1" as parameters name but results are like : Data Source = DataSource1; Initial Catalog = DataSource1. I have run this report using shared data source.Hamza
If it displays your expected connection string, yes it's giving correct results. If it works with a static connection string and your expression is returning the same connection string, it should work. Are you sure there isn't something else? Where are your credentials set, in the ConnectionString or in the Credentials tab?Sébastien Sevrin

1 Answers

0
votes

You can't use a Shared Data Source with a dynamic data source. Use an embedded one. I think it's to prevent you from corrupting other reports' data sources.

http://www.keepitsimpleandfast.com/2012/08/how-to-use-dynamic-data-sources-in-your.html