frustrating problem changing a connection string in property settings

B

BillE

I'm using vs2008, v 9.0.30729.1 sp

My windows forms project uses several connection strings, so I save them all
in the Project Properties screen, on the Settings tab.

The problem is that when I change one connection string, they are all
changed to the same value.

The same thing happens in VB and C#. It never happened until i
unfortunately upgraded to VB2008.

Specifically..
- I create a new project and add three connection strings. The all have
the same connection string value. I Save and build the project.
- I change the value of one of the connection strings in the Project
Properties window, on the Settings tab.
- I save and close the Project Properties window. When I reopen the
Properties window, I get the following message in a popup:
"Value of setting 'connstring' was changed in the app.config
file"
[contents of app.config file are displayed here]
[contents of settings.settings file are displayed here]
"Do you want to update the value in the .settings file?"

If I respond Yes, then the spontaneous, undesired changes in the app.config
file are saved to settings.settings file.

If I respond No, then the app.config and settings.settings files are
different, and I never know which connection string is being used.

After I change the value of a connection string, if I click in the value
field of another connection string, it is modified to the new value of the
changed connection string, as if I had copied and pasted the value.

Thanks
Bill
 
F

Frans Bouma [C# MVP]

BillE said:
I'm using vs2008, v 9.0.30729.1 sp

My windows forms project uses several connection strings, so I save them all
in the Project Properties screen, on the Settings tab.

The problem is that when I change one connection string, they are all
changed to the same value.

The same thing happens in VB and C#. It never happened until i
unfortunately upgraded to VB2008.

Specifically..
- I create a new project and add three connection strings. The all have
the same connection string value. I Save and build the project.
- I change the value of one of the connection strings in the Project
Properties window, on the Settings tab.
- I save and close the Project Properties window. When I reopen the
Properties window, I get the following message in a popup:
"Value of setting 'connstring' was changed in the app.config
file"
[contents of app.config file are displayed here]
[contents of settings.settings file are displayed here]
"Do you want to update the value in the .settings file?"

If I respond Yes, then the spontaneous, undesired changes in the app.config
file are saved to settings.settings file.

If I respond No, then the app.config and settings.settings files are
different, and I never know which connection string is being used.

After I change the value of a connection string, if I click in the value
field of another connection string, it is modified to the new value of the
changed connection string, as if I had copied and pasted the value.

I read your subject line and remembered I've been in exactly the same
situation, eventually giving up on that properties crap and simply
editing the connection string in the app.config file and be done with
it. After all, it ends up there, why bother with completely useless UI
dialogs which are hard to use.

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
J

Jeff Johnson

My windows forms project uses several connection strings, so I save them
all in the Project Properties screen, on the Settings tab.

I store all my connections strings as strings, not as the speciall
connection string type. I don't see what the advantage to that type is other
than the dialog, and I've worked with connection strings for so long that I
don't need no steenking dialog....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top