The options are completely different for web or Windows applications so if
you're looking for one "best place" you might not find it.
You could, but I wouldn't recommend it, create an static ArrayList property
in your DAL that you could register users and the appropriate database but
then you'd have to handle logouts, broken connections, and other concurrency
issues.
You could just set an instance property with the appropriate value in the DAL
Alternatively, you could issue an SQL command to change the default database
for the user when they log in and then do not include the "initial catalog"
section in the connection string. The user will default to their configured
default database.
For web, you can use Session state or Viewstate objects to store the
database name.
For Windows, you can store the value in the registry, in an appropriately
scoped variable or class or even in an XML configuration file.
HTH
DalePres
MCAD, MCDBA, MCSE
"Phenix Smith" wrote:
We have a set of objects that use a DAL to connect to SQLServer. The
database they will be using is selected during login. Where is the best
place to hold this information so the DAL can use it no matter if it is Web
or Win.
Phenix