Dynamically Create ConnectionString - SelfServicing

Posts   
 
    
Bashar
User
Posts: 108
Joined: 11-Nov-2004
# Posted on: 02-Dec-2006 12:50:44   

Hi Guys,

  • LLBLGen Pro version + buildnr: Version 2.0.0.0 November 6th 2006

How can I dynamically create a ConnectionString in a SelfServicing project?

Thanks, Bashar

Chester
Support Team
Posts: 223
Joined: 15-Jul-2005
# Posted on: 02-Dec-2006 23:33:58   

Bashar wrote:

Hi Guys,

  • LLBLGen Pro version + buildnr: Version 2.0.0.0 November 6th 2006

How can I dynamically create a ConnectionString in a SelfServicing project?

Thanks, Bashar

From the docs section "Generated code - DbUtils functionality":

Connection strings The DbUtils class lets you set the global connection string to use for every connection to the database. This setting overrides the connection string read from the appSettings section in the .config file. Once the setting is set, every connection to the database uses the set connection string. You set the connection string to use at runtime using the following code:

// C# DbUtils.ActualConnectionString = "Datasource=myserver;....";

' VB.NET DbUtils.ActualConnectionString = "Datasource=myserver;...."

If you want to make the application use the connection string defined in the config file again, simply set the ActualConnectionString property to string.Empty.

Bashar
User
Posts: 108
Joined: 11-Nov-2004
# Posted on: 03-Dec-2006 07:15:14   

Thank you very much chester. Guess I've been lazy lately, I should've read the docs more thoroughly before adding a new thread to the forum.

Thanks, Bashar