Issue with Applications Settings connection string

EllisFab

New member
Joined
Jun 23, 2009
Messages
1
Programming Experience
3-5
Hi there,

I am new to the forums and wondering if anyone has had a similar issue. I have been programming with VB.Net for a few years however always with the original 1.0 and just diving into the new 3.5. Anyway, Here are the details:

I am working with Visual Studio 2008

I set up an original connection to my SQL Server Db, and when I did creating datasets etc, never caused an issue. However once I wanted to change to a connection that would allow me to deploy this app anywhere on the network, when I add new datasets, it recreates the old local connection string and references it, so that throughout the app, its using "constring1" instead of "constring"

Here is my cross network "constring":
Data Source=122.222.0.222;Initial Catalog="** **";Persist Security Info=True;User ID=****;Password=****;Network Library=dbmssocn

Here is what it keeps changing back to:
Data Source=SERVERNAME;Initial Catalog="** **";Integrated Security=True

Now just in case it helps, my SQL Server is running on the computer I am developing on. And the IP address that would be in place of 122.222.0.222 is the ip address of the development computer.

Thank you everyone and hope I described it well enough!
Ellis Fab
 
I'm not sure exactly what you've done but, if you want to connect to a different database, you're supposed to just open the config file and edit the connection string. That's the whole reason that the connection string is stored in the config file in the first place.
 
If you opened your Settings and changes the constring so it was no longer Application Scope (Connection String) but instead just a normal User Scope (string)..

..this is why your new datasets cannot "find" the old connection string.

You must revert it to Application Scope (ConnectionString) type to use it with the dataset designer. There are other ways of making it possible to change the conenction string at run time. It really deepdsn on whether the user chooses every time the db to use, or whether you want the setting to persist between app restarts, as to how you go about it
 

Latest posts

Back
Top