G
Guest
I've just been assigned my first Winforms development project in Dot Net 2.0.
It is a given in my current company that any Winforms program will have to
easily shift between multiple identical servers. I would like to design this
to take maximum advantage of VS2005's design features. I am probably not as
familiar with them as I would like to be.
To this end I have created a no-brainer demo program using the pubs authors
table and the DataViewGrid (i.e. create a datasource and drag it on the
form).
Assuming that, I have created 2 buttons on the form.
Button1's code:
Me.AuthorsTableAdapter.Connection.ConnectionString = "Data
Source=(local);Initial Catalog=pubs;Integrated Security=True"
Me.AuthorsTableAdapter.Fill(Me.PubsDataSet.authors)
Button2's code:
Me.AuthorsTableAdapter.Connection.ConnectionString = "Data
Source=SomeOtherServerName;Initial Catalog=pubs;Integrated Security=True"
Me.AuthorsTableAdapter.Fill(Me.PubsDataSet.authors)
This seems to do exactly what I need. I can shift between the 2 servers and
edit either without trouble. Are there any 'booby traps' in this approach
that I might be overlooking? (In the actual project I will probably have to
include some code to get connection strings from an external config file on
startup.)
It is a given in my current company that any Winforms program will have to
easily shift between multiple identical servers. I would like to design this
to take maximum advantage of VS2005's design features. I am probably not as
familiar with them as I would like to be.
To this end I have created a no-brainer demo program using the pubs authors
table and the DataViewGrid (i.e. create a datasource and drag it on the
form).
Assuming that, I have created 2 buttons on the form.
Button1's code:
Me.AuthorsTableAdapter.Connection.ConnectionString = "Data
Source=(local);Initial Catalog=pubs;Integrated Security=True"
Me.AuthorsTableAdapter.Fill(Me.PubsDataSet.authors)
Button2's code:
Me.AuthorsTableAdapter.Connection.ConnectionString = "Data
Source=SomeOtherServerName;Initial Catalog=pubs;Integrated Security=True"
Me.AuthorsTableAdapter.Fill(Me.PubsDataSet.authors)
This seems to do exactly what I need. I can shift between the 2 servers and
edit either without trouble. Are there any 'booby traps' in this approach
that I might be overlooking? (In the actual project I will probably have to
include some code to get connection strings from an external config file on
startup.)