Create a database when it doesn't exists yet
Posted: Thu 03 May 2012 21:37
Hello,
Is there a way to create a new database?
I have this code:
string connectionString = "Data Source=(local);Database=mTest;Integrated Security=True;Persist Security Info=True";
MContext m = new MContext(connectionString);
m.Connection.Open();
m.CreateDatabase(true, true);
I cannot open it because the mTest database doesn't exist yet.
Is there a way to create a new database?
I have this code:
string connectionString = "Data Source=(local);Database=mTest;Integrated Security=True;Persist Security Info=True";
MContext m = new MContext(connectionString);
m.Connection.Open();
m.CreateDatabase(true, true);
I cannot open it because the mTest database doesn't exist yet.