Page 1 of 1

Change connection string using VB.Net Code

Posted: Fri Sep 02, 2011 2:46 pm
by James Wong
Sometimes the Access database location is change. I want the user to specify the new location of this database and have the new location set in the connection string. How do I use VB.Net code to change the connection string before viewing the report?


Thanks.



Change connection string using VB.Net Code

Posted: Mon Sep 05, 2011 5:50 am
by Alex K.
Hello,

You can use the following code:

Code: Select all

DirectCast(report.Dictionary.Databases("Connection"), StiSqlDatabase).ConnectionString = "New connection string"
Thank you.

Change connection string using VB.Net Code

Posted: Fri Sep 09, 2011 2:10 pm
by ainaz
Hello

I have the same question


Can you explain more where should I use this code

Is there a file like C# (app.config)

Please enter the code again to C #

Thank you


Image

Change connection string using VB.Net Code

Posted: Mon Sep 12, 2011 1:14 am
by Alex K.
Hello,

You can use the following code:

Code: Select all

((StiSqlDatabase)report.Dictionary.Databases["Connection"]).ConnectionString = "New connection string";
Thank you.