Hello.

I wonder if anyone can help me.
I have the Following XML file, where I load multiple SQL database connection details:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ConnectionDetails>
<ConnectionName ID="1">DAWS</ConnectionName>
<ServerName>LOLLIE</ServerName>
<DbName>DAWS</DbName>
<UserName>sa</UserName>
<Password>sa</Password>
<Network>TCP/IP</Network>
<ConnectionDetails>
<ConnectionName ID="2">FreightEquipe</ConnectionName>
<ServerName>FREIGHTFOCUS2</ServerName>
<DbName>FE</DbName>
<UserName>sa</UserName>
<Password>sa</Password>
<Network>TCP/IP</Network>
</ConnectionDetails>
<ConnectionDetails>
<ConnectionName ID ="3">Media Express</ConnectionName>
<ServerName>FREIGHTFOCUS2</ServerName>
<DbName>ME</DbName>
<UserName>sa</UserName>
<Password>sa</Password>
<Network>TCP/IP</Network>
</ConnectionDetails>
</ConnectionDetails>

I have a SQL login screen with a listbox that loads the "ConnectionName" from the XML file.
Now you have a "Change" button on the this form that when clicked opens a form that will display the different connection details based on the connection name selected in the list box before clicking the "Change" button. How do I do this?

Is your question, "how do i read from an xml file?" if so, try something like this....it returns the element value for datasource.

Dim xReader As New XmlTextReader(value & "\xmDatabasePath2.xml")
Dim strReturnString As String = vbNullString
xReader.WhitespaceHandling = WhitespaceHandling.None
Do While True
If xReader.Name = "Datasource" Then
Return xReader.ReadElementString
End If
xReader.Read()
Loop

In your opinion, do you think it would be better to read and store this info in a normal text file?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.