Re: connection string bug? Big Problem.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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








.



Relevant Pages

  • Re: connection string bug? Big Problem.
    ... I created a new project and added four connection strings. ... It sounds like you have some sort of bug with your settings. ... Public Const connectionString1 As String = "ConnectionString1" ...
    (microsoft.public.dotnet.languages.vb)
  • Re: connection string bug? Big Problem.
    ... It sounds like you have some sort of bug with your settings. ... I have several connection strings in my project. ... Public Const connectionString1 As String = "ConnectionString1" ...
    (microsoft.public.dotnet.languages.vb)
  • Re: connection string bug? Big Problem.
    ... I have several connection strings in my project. ...     Value of setting 'connstring' was changed in the app.config file ... Public Const connectionString1 As String = "ConnectionString1" ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Using a function instead of web.config to store connectionstring
    ... function is built in for you to store connection strings securely. ... Add your connection string to your web.config as normal. ... (ByVal sender As Object, ByVal e As System.EventArgs) ... And I can do some weak encryption of the web.config. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: ADO connect string question
    ... > The OLE DB Provider for Jet 3.51 is a limited provider. ... building and testing connection strings is one of the few good uses for the ... the connection object and go to properties and build the connection. ...
    (microsoft.public.vb.general.discussion)