Re: connection string bug? Big Problem.
- From: "BillE" <belgie@xxxxxxxxxxx>
- Date: Mon, 24 Nov 2008 09:15:33 -0500
I manage connection strings in the Project Properties screen, on the
Settings tab.
"JimmyKoolPantz" <kohl.mike@xxxxxxxxx> wrote in message
news:67b2276e-da51-4a9c-83df-09f25a0e537a@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Nov 21, 12:04 pm, "BillE" <bel...@xxxxxxxxxxx> wrote:
What the heck is going on?
I have several connection strings in my project.
When I change one of them, they are all changed to the same value!
Sometimes, if I change one connection string in the Settings tab of the
Project Properties page and then close the properties, I get the following
message when I open the properties again:
Value of setting 'connstring' was changed in the app.config file
The current value in the .settings file is ------
The new value in the app.config file is -----
Do you want to update the value in the .settings file?
I get the message for each of the other connection string entries.
This is a big problem.
This is a VS 2008, vb.net windows forms project.
Im not sure where your declaring your connection strings it sounds
like you have it in the app.config file which is a good secure place
for it. I normally use C# ;however, I will demonstrate how we would
do something like this at work
We would problably create a new class in the project (usually for
global functions and variables)
Public Class c
#Region "Connection Strings"
Public Const connectionString1 As String = "ConnectionString1"
Public Const connectionString2 As String = "ConnectionString2"
Public Const connectionString3 As String = "ConnectionString3"
#End Region
End Class
and then somewhere in your applications you can call the connection
strings
Dim cn = New SqlConnection(c.connectionString1)
if you are actually changing the connection strings in the properties
of your application (on the fly) I would do something like
Public Class c
#Region "Connection Strings"
Public connectionString1 As String = "ConnectionString1"
Public connectionString2 As String = "ConnectionString2"
Public connectionString3 As String = "ConnectionString3"
#End Region
End Class
And then declare a new instance somewhere in your application
public MyConnectionStrings as c = new c
Dim cn = New SqlConnection(MyConnectionString.ConnectionString1)
Finally, if all connectionstrings have the same value and u dont want
them to, then I would check your code to see if your updating the
correct connection string in your code.
- Jimmy
.
- Follow-Ups:
- Re: connection string bug? Big Problem.
- From: dotNetDave
- Re: connection string bug? Big Problem.
- References:
- connection string bug? Big Problem.
- From: BillE
- Re: connection string bug? Big Problem.
- From: JimmyKoolPantz
- connection string bug? Big Problem.
- Prev by Date: RE: Differential backup problem in SMO
- Next by Date: Re: System.IO.Ports.SerialPort Read Issue
- Previous by thread: Re: connection string bug? Big Problem.
- Next by thread: Re: connection string bug? Big Problem.
- Index(es):
Relevant Pages
|