Yikes !!, I'm sorry for the confusion.
I meant to change the database name in the connection string, not to
change the physical name of the database on SQL Server.
But I do need several databases, that's how this was designed. I told
the reason is to circunvent the 4Gb size limit. That's enough reason.
The $6,000 usd price of the standard version is enough reason. More
reason if you have to multplie this for 4-6, while you can have it free
(please, don't ask me use MySQL).
Just to prove I'm not crazy the data model goes like:
LogSettingsDB ( a database)
---- Users Table (a table)
---- Configuration Table
---- Other Table
Log0001DB
---- Logs Table (Stores info of John and Kevin).
Log0002DB
---- Logs Table (Stores info of Paul)
Log0003DB
---- Logs Table (Stores info of Mike, George and Anthony)
Now, the users table goes like (snippet):
-- userID: 1
-- userName: John
-- AsignedDatabase: Log0001DB
Other user:
-- userID: 2
-- userName: Kevin
-- AsignedDatabase: Log0001DB
Other user:
-- userID: 3
-- userName: Paul
-- AsignedDatabase: Log0002DB
Other user:
-- userID: 4
-- userName: Mike
-- AsignedDatabase: Log0003DB
So, after the user is logged and for this it connected to
LogSettingsDB, I need to create/generate/manipulate (this is my
question) another connection string which must be created based on the
"AssignedDatabase" column in the user's settings.
Regards,
Kevin Spencer wrote:
> You don't need to and should not change a database name. You don't need
> multiple databases. You need to understand how to design databases. If you
> need to store information about hundreds of people, you may need several
> tables in a single database, but you will only need one record per table per
> person. I would suggest downloading the (free) SQL Server Books Online at
> http://www.microsoft.com/technet/pro...ads/books.mspx.
>
> --
> HTH,
>
> Kevin Spencer
> Microsoft MVP
> Chicken Salad Surgery
>
> What You Seek Is What You Get.
>
> <> wrote in message
> news: oups.com...
> > How to change database name on the fly?
> >
> > I have an asp.net application in which a user connects to a sql server,
> > where there's a centralized database with the users table and general
> > settings.
> > Then, each user also has a database in which his particular information
> > is stored. There will be a few hundreds of this databases. Certain
> > groups of users will share a database, all tables in this database have
> > a userid column for identification which rows are whose. (BTW, this
> > strange setup is to circunvent the 4GB limit on SQL Server Express,
> > don't see me, ask my boss).
> >
> > Now, how do I implement this in asp.net? The web.config contains a
> > hardcoded connection string, which right now points to the centralized
> > database and works up to the login point.
> > After that I don't know what to do next.
> > I'm using a BLL and DAL layers which points directly to this database
> > connection string.
> >
> > I mean, even if I store a second connection string, how am I supposed
> > to change the databasename ? simple search&replace ?
> > Are there known techniques, approaches or pattern to do this ?
> >