开发者

configure the connectionString of a tableAdaptor manually in reportViewer

开发者 https://www.devze.com 2023-02-08 06:32 出处:网络
Hy! I create a reportV开发者_运维问答iewer withand i want to change the connectionString of the tableAdapter from the code (this string will be changed at runtime and it`s stored in a settings.xml fi

Hy!

I create a reportV开发者_运维问答iewer with and i want to change the connectionString of the tableAdapter from the code (this string will be changed at runtime and it`s stored in a settings.xml file).

can anyone help me?


You should be able to the ConnectionModifier of the TableAdapter to public and then access its ConnectionString property

DataSet1TableAdapters.TestTableAdapter testTableAdapter = new DataSet1TableAdapters.WagesTableAdapter();

testTableAdapter.Connection.ConnectionString = "someconnectionstring";


The way i figured out it was to use the same xsd columns and the name of the columns had to be the same and in this way I used only 1 table for more reports (but in this table it were all the columns I needed for all reports)


If you are using Server Report you can Use Expression to build your datasource connection string, and build this expression using parameters. so add parameters for server, Database, .. etc then you can send your connection string from code to these parameters.

You can find more details in this article.

https://blogs.msdn.microsoft.com/bimusings/2006/07/20/more-fun-with-expression-based-connection-strings-in-reporting-services/

0

精彩评论

暂无评论...
验证码 换一张
取 消