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.
Create a database when it doesn't exists yet
Re: Create a database when it doesn't exists yet
The problem is that the connection cannot be opened because the database 'mTest' does not exist.
So, you can try the following way: do not specify the database in the connection string and then perform CreateDatabase method.
For example:
For more information about database creation see:
http://www.devart.com/linqconnect/docs/DDL.html
So, you can try the following way: do not specify the database in the connection string and then perform CreateDatabase method.
For example:
Code: Select all
string connectionString = "Data Source=(local);Integrated Security=True;Persist Security Info=True";
MContext m = new MContext(connectionString);
m.Connection.Open();
m.CreateDatabase(true, true);
For more information about database creation see:
http://www.devart.com/linqconnect/docs/DDL.html