Override Stored Connection String
-
I 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?
-
I 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?
You might be better asking this in the VB forum, Dave Kreskowiak may be able to help, he seems to know how these bloody MS wizard tools seem to work.
Never underestimate the power of human stupidity RAH
-
I 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?
You could always try and not using wizard and program it yourself, at first its hard but it gets easier as you go along.
DEVELOPER DAY SCOTLAND 2009 Watch this space http://www.developerdayscotland.com/[^]
-
You could always try and not using wizard and program it yourself, at first its hard but it gets easier as you go along.
DEVELOPER DAY SCOTLAND 2009 Watch this space http://www.developerdayscotland.com/[^]