Friday, July 18, 2008

How to change the connection string name in a .NET 3.5 LINQ to SQL class?

Here's the scenario:

You developed an application that uses "LINQ to SQL" with a connection string name (say aa-db). In production you want the name to be different (say bb-db). What do you need to do to change the connection string name?

1) Open the *.dbml file in a text editor.

2) Change the "SettingsPropertyName=" property to the new name

3) Open the "*.designer.cs" file that is associated with the LINQ class and change the value of global::System.Configuration.ConfigurationManager.ConnectionStrings[...].

No comments:

Post a Comment