E
Etienne-Louis Nicolet
I'm working on an application where the user should be able to log on to
different databases (test database, production db, etc.).
Since in my TableAdapter classes I have the choice to either hard code the
connection string in the class or to store the connection string in the
(read-only) application settings, I see way to have the user change these
settings during execution of the application.
I therefore created a user setting with the connection string (as string)
and added a method to every single TableAdapter which i have to call
whenever i instantiate a TableAdapter:
Public Sub SetConnectionString
' My.Settings.MyConnectionString is set when the user logs on to the
database
Me.Connection.ConnectionString = My.Settings.MyConnectionString
End Sub
In order to overcome this repetitive task of adding the above method to
every Adapter I'm looking for a way to create a class which handles this
task for all TableAdapters. Does anybody have an idea how to approach the
problem?
Many thanks for any suggestions,
Etienne
different databases (test database, production db, etc.).
Since in my TableAdapter classes I have the choice to either hard code the
connection string in the class or to store the connection string in the
(read-only) application settings, I see way to have the user change these
settings during execution of the application.
I therefore created a user setting with the connection string (as string)
and added a method to every single TableAdapter which i have to call
whenever i instantiate a TableAdapter:
Public Sub SetConnectionString
' My.Settings.MyConnectionString is set when the user logs on to the
database
Me.Connection.ConnectionString = My.Settings.MyConnectionString
End Sub
In order to overcome this repetitive task of adding the above method to
every Adapter I'm looking for a way to create a class which handles this
task for all TableAdapters. Does anybody have an idea how to approach the
problem?
Many thanks for any suggestions,
Etienne