Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenFileDialog XML app.config database location

Status
Not open for further replies.

vttech

Technical User
Jan 28, 2006
297
US
I have an xml file create in the IDE called app.config that stores
the location of my database for my app THanks Spebby

Code:
<connectionStrings>
    <add name="DatabaseConnection"
        connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=
        M:\VB_NET_2005\TimeSheet\bin\Debug\TSDB.mdb"
        providerName="System.Data.OleDb" />
  </connectionStrings>


I create a an OpenFileDialog that I create that will get the location of the database

Code:
Dim OpenDialog As New OpenFileDialog

        OpenDialog.Title = "Open Database"
        OpenDialog.Filter = "Microsoft Access Database (*.mdb)|*.mdb|All Files (*.*)|*.*"
        OpenDialog.FileName = ""
        OpenDialog.FilterIndex = 0

        OpenDialog.InitialDirectory = "C:\Program Files"

        OpenDialog.CheckFileExists = True
        OpenDialog.CheckPathExists = True

        If OpenDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then

            '(OpenDialog.FileName)

        End If



My problem is how do I use the OpenDialog.Filename to edit the XML file and change the path of the database?

example how to change the path from
M:\VB_NET_2005\TimeSheet\bin\Debug\TSDB.mdb to the string stored in OpenDialog.FileName

Newbie in search of knowledge
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top