Monday, March 22, 2010

connection string in .net

In .net we can separate the connection string from the config file (app.config/web.config).
Here's how to do it:
1) Create ConnectionString.config, place this file in the same file as your config file.
Copy and paste the connection string from your config file to this file.
<connectionstrings>
<add name="AIConnectionString" connectionString="VsE02TxJgFtwnFegSRgcJtT9lrEl4ZFtSY+"  providerName="System.Data.SqlClient" />
</connectionStrings>
2) In your config file, replace the connection string with this:
<connectionstrings configSource="ConnectionString.config"/>
Thinking of consolidating all your other batches to use one connection string file only?
This is not possible, pls see the reference below.
Reference: here

No comments: