Change connection string using VB.Net Code

Stimulsoft Reports.NET discussion
Post Reply
James Wong
Posts: 3
Joined: Fri Sep 02, 2011 2:40 pm
Location: Canada

Change connection string using VB.Net Code

Post 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.


Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Change connection string using VB.Net Code

Post 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.
ainaz
Posts: 4
Joined: Thu Sep 01, 2011 2:37 pm

Change connection string using VB.Net Code

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Change connection string using VB.Net Code

Post by Alex K. »

Hello,

You can use the following code:

Code: Select all

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