Hi,

I've noticed that if I change my connectionstring in the app.config file,
this isn't enough, a second change in the Global.System.Configuration is
necesary!!!

This means that after deployment and if the SQL server is changed, changing
the code is necesary, ..............?.??

can I prevent this?? HOW???

Thx

--
Best regards
Luc N

Re: Change connectionstring Typed dataset by Miha

Miha
Sun Jul 29 13:56:19 CDT 2007

When you deploy the properly configured app.config (or better,
ASSEMBLYNAME.config) is enough.
When developing, though, the correct way is to change the value in
Project/Settings configuration.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Luc" <Luc@discussions.microsoft.com> wrote in message
news:65260708-0124-4BAE-AAA3-FBD9D2F517E9@microsoft.com...
> Hi,
>
> I've noticed that if I change my connectionstring in the app.config file,
> this isn't enough, a second change in the Global.System.Configuration is
> necesary!!!
>
> This means that after deployment and if the SQL server is changed,
> changing
> the code is necesary, ..............?.??
>
> can I prevent this?? HOW???
>
> Thx
>
> --
> Best regards
> Luc N


Re: Change connectionstring Typed dataset by Sheng

Sheng
Mon Jul 30 14:17:57 CDT 2007

You can handle the SettingsLoaded event to set the connection string setting
at runtime
void Settings_SettingsLoaded(object sender, SettingsLoadedEventArgs e)
{
this["ConnectionString"] = GetConnectionString();
}

--
Sheng Jiang
Microsoft MVP in VC++
"Luc" <Luc@discussions.microsoft.com> wrote in message
news:65260708-0124-4BAE-AAA3-FBD9D2F517E9@microsoft.com...
> Hi,
>
> I've noticed that if I change my connectionstring in the app.config file,
> this isn't enough, a second change in the Global.System.Configuration is
> necesary!!!
>
> This means that after deployment and if the SQL server is changed,
changing
> the code is necesary, ..............?.??
>
> can I prevent this?? HOW???
>
> Thx
>
> --
> Best regards
> Luc N



Re: Change connectionstring Typed dataset by Miha

Miha
Mon Jul 30 15:29:34 CDT 2007

What's the point of settings then :-)

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

"Sheng Jiang[MVP]" <sheng_jiang@hotmail.com.discuss> wrote in message
news:%23g5sU5t0HHA.3536@TK2MSFTNGP06.phx.gbl...
> You can handle the SettingsLoaded event to set the connection string
> setting
> at runtime
> void Settings_SettingsLoaded(object sender, SettingsLoadedEventArgs e)
> {
> this["ConnectionString"] = GetConnectionString();
> }
>
> --
> Sheng Jiang
> Microsoft MVP in VC++


Re: Change connectionstring Typed dataset by Sheng

Sheng
Mon Jul 30 16:23:18 CDT 2007

To make the dataset designer happy...

--
Sheng Jiang
Microsoft MVP in VC++
"Miha Markic" <miha at rthand com> wrote in message
news:eJkv1hu0HHA.5152@TK2MSFTNGP02.phx.gbl...
> What's the point of settings then :-)
>
> --
> Miha Markic [MVP C#, INETA Country Leader for Slovenia]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>
> "Sheng Jiang[MVP]" <sheng_jiang@hotmail.com.discuss> wrote in message
> news:%23g5sU5t0HHA.3536@TK2MSFTNGP06.phx.gbl...
> > You can handle the SettingsLoaded event to set the connection string
> > setting
> > at runtime
> > void Settings_SettingsLoaded(object sender, SettingsLoadedEventArgs e)
> > {
> > this["ConnectionString"] = GetConnectionString();
> > }
> >
> > --
> > Sheng Jiang
> > Microsoft MVP in VC++
>



typed dataset - change connection string after by Saulo

Saulo
Thu Aug 02 07:40:28 CDT 2007

My development team faced this problem in the last week when we were developing some distributed system.

One choice your have is to:

1 - Eliminate the connectionstring from "Settings" of the typed datasets;
2 - Add the System.Configuration reference to the typed dataset project
3 - Go to each typed dataset Designer.vb file and REPLACE the statement:
"Me._connection.ConnectionString = Global..."
for this one:

Me._connection.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("CONNECTION")"

4 - Now your datasets should look for this tag, in the app.config XML file.
5 - If you don't provide the DAL.appconfig.xml file, the typed datasets will look for the Application.appconfig.xml and ... in this XML file you must add the tag:
...
</configSections>
<appSettings>
<add key ="CONNECTION" value ="connection string comes here"/>
</appSettings>
<connectionStrings>
...
See that it comes between configsections and appSettings.

6 - Now if you have the appconfig.xml for the application, you can benefit from taking the connectionstring from this file, instead of having it compiled into the DAL.dll. You can change the connection string in the xml file and see the changes in the connection.

For now, this is the only solution we have achieved for this problem.

EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com