Hi,
We have an app that is made of many exes (WinForms and Win32 app).
All those exes share and read their DB connection string from the
registry. This guarantees that all the exes use the same DB.
With .Net the connection string is in the app.config file as soon as
you use the design time functionality to bind data to grids as an
example. So when you have 20 exes you have 20 app.config and the
possibility to use 20 different connection string which is really bad!
So I want to use that shared and common DB connection string. The
problem is that it seems we either have the choice of writing all the
code manually in which case we can control the connection string or
using the design time functions of VS but then we lose control of the
connection string which goes into the app.config file.
The question is how can you still use the VS.Net design time function
but make sure that you can when the app start specify the connection
string you want and not the one in the app.config?
I can see that in the data adapters the auto-generated code specifies:
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
private void InitConnection() {
this._connection = new
System.Data.SqlClient.SqlConnection();
this._connection.ConnectionString =
global::ForecastSkillVerification.Properties.Setti ngs.Default.Speed_62_MM_GOODConnectionString;
}
Therefore it seems that if there is a way to override the value of:
global::ForecastSkillVerification.Properties.Setti ngs.Default.Speed_62_MM_GOODConnectionString
at the start of the program then my problem would be solved.
Unfortunately
global::ForecastSkillVerification.Properties.Setti ngs.Default.Speed_62_MM_GOODConnectionString
is read-only.
Any solutions to these guys?
thanks,
M
--
Michael
----
http://michael.moreno.free.fr/
http://port.cogolin.free.fr/