Here is the solution as untyped datasets were not an option. http://kmccaa.blogspot.com/2007/07/how-to-move-typed-dataset-to-its-own_11.html[^]
chrisace
Posts
-
Override Stored Connection String -
Override Stored Connection StringI have a Windows application that uses typed datasets. When setting up the datasets, Visual Studio asks if you want to remember the connection. This is helpful when making changes to the datatables or table adapters. Before filling the dataset, I programatically change the connection string of each table adapter so that it will connect to the remote database. Before this operation, it is set to the local database since that is the one I am developing on. All goes well except with one form. See the sequence of events below: First I change the connection string. Me.LocationsTableAdapter.Connection.ConnectionString = Database.gdbRemoteConnection.ConnectionString When calling the following fill method, it works as it should. Me.LocationDataTableAdapter.FillByLocationID(Me.DsLocations.LocationData, cmbTestLocation.SelectedValue) When calling the following fill method, it displays an error message saying the database location is not correct. It is referencing the local database even though I changed the connection string. Me.LocationDataTableAdapter.FillByEntryDate(Me.DsLocations.LocationData, dtmDateFrom.Value.Date, dtmDateTo.Value.Date) If I step through the code, it even shows the connection string set to the remote database when the fill method is called. Is this a known bug?