ExecuteTransactionlessNonQuery() public method

public ExecuteTransactionlessNonQuery ( string sql, int timeout = 30 ) : void
sql string
timeout int
return void
Esempio n. 1
0
        public void CreateDatabase(string scriptFilePath, string databaseName)
        {
            var tasks = new DatabaseTasks(_executeMaster);

            if (tasks.Exists(databaseName))
            {
                tasks.SetOnline(databaseName);                 // if dropping a database that is offline, the file on disk will remain!
                _executeMaster.ExecuteTransactionlessNonQuery(
                    string.Format("ALTER DATABASE [{0}] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;", databaseName));
                tasks.Drop(databaseName);
            }


            try
            {
                var script = File.ReadAllText(scriptFilePath + "CreateDB.sql");
                script = ReplaceScriptTags(script, databaseName);
                _executeMaster.ExecuteTransactionlessNonQuery(script, 10800);
            }
            catch (Exception exception)
            {
                string msg = exception.StackTrace;
            }
        }
Esempio n. 2
0
 public void Drop(string databaseName)
 {
     _executeMaster.ExecuteTransactionlessNonQuery(string.Format("DROP DATABASE [{0}]", databaseName), 120);
 }