views:

43

answers:

2

Possible Duplicate:
Best practice to create (on demand) SQL Server 2008 Express databases in C#?

In SQL Server Express (which is included with Visual Studio 2008), can I create a database dynamically at runtime? I mean create a database, not create a table.

+1  A: 

Yes you can with the Create Database command. It can run just as a normal SqlCommand. You will have to supply a fully qualified path for the database path.

For you initial connection you can always connection to the master database.

shf301