Start New Discussion within our Software Development Community

Hi guys.

I have now looked at hundreds of articles and forums for solutions.
I have the following forms:
A db selector form. The form has a combobox where I want to load the connections(connection name) you want to use to connect to a sql database. I need the user to be able to have multiple connections. I have a "Add" button on the form tha opens another form when clicked. This second form(Connection Add) has five fields: Connection Name, Server Name, Database NAme, User and Password. Here the user can add the connection details which will be used to build the connection string for the new connection. Once the details are entered a OK button is clicked to save the details.

I can save this to the database, but as the application hasn't connected to a database yet and I would not like to have a table to only save connections strings, this is not the option for me. I found a lot off articals on the connectionstring settings in the app.config file, but this is read only.

The other view is to create your own xml file. I am not to confident in working with xml. I can create a doc from scratch, but how do you add to it and how do you update a selected connection and retrieve the details based on a selected connection.

Any help would be appreciated. I am using Visual Basic 2005 Express with both SQL 2000 and SQL 2005

Thanks

Using XML files is not that difficult. If you want to try XML here's a simple code how to modify XML file. And this article shows how to read/search XML file with XPath. You'll also get the idea, how to structure connection string parts in XML file.

But how about storing connection strings to a plain text file? The problem is, however, with both XML and text files that your user names and passwords are in plain text. If this not an issue then you can just use simple text file.

This article has been dead for over six months. Start a new discussion instead.