using SMO to create a database, and choose location!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hey, I'm using SMO to create a databas.e easy stuff

ServerConnection srvcon = new
ServerConnection("MYCOMPUTER");
Server serv = new Server(srvcon);

Database db = new Database(serv, "MyDatabase");

db.Create();

but where can I modify the filename properties??

I need the DB to be stored in a specific location only. THANKS!
 
Rogelio,

The Database class exposes the FileGroups property which has the
filegroups which are used for the database. When creating a new instance,
you will want to work with this property (and the objects it exposes) to set
the filegroup for the new database.
 
Back
Top