I am writing a rather complex application. The Application connects to a SQL Server Database to retrieve and store information.
I usually work on the code either on my laptop or my desktop computer at work. I have a copy of SQL Server on each of the machines with a copy of the database backup that I keep up to date and update on both machines when I make any changes.
SQL Server on Laptop : MOBILESERVER\SQLDB Catalog=FileStoreDB
SQL Server on Desktop: ITSERVER\SQLDB Catalog=FileStoreDB
Now, I would like a way to modify the connection string in the app.config at run time. So that I can simply pick from a drop down list whether I am at work or at home and the application would use the appropriate connection string.
I know how to write the IF statement to modify the string. I want to know how to modify the app.config to accept the change and apply it. Or if there's another way to do that?
any help would be appreciated.
Which Declarations and Which properties or methods do I need to use?
Private Sub cboLocation_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboLocation.SelectedIndexChanged
If cboLocation.Text = "Home" Then
'Code Should Go here
ElseIf cboLocation.Text = "Work" Then