Beispiel #1
0
 public void DropMySqlDatabase(string dbName)
 {
     using (var sysConnection = new MySqlConnection(HelperDB.GetMySqlDatabaseConnectionString("sys")))
     {
         sysConnection.Open();
         var cmdDb = new MySqlCommand($"drop database if exists {dbName};", sysConnection);
         cmdDb.ExecuteNonQuery();
         sysConnection.Close();
     }
 }
Beispiel #2
0
        public void CreateMySqlDatabase(string dbName)
        {
            MySqlConnection sysConnection = null;
            MySqlCommand    cmdDb         = null;

            sysConnection = new MySqlConnection(HelperDB.GetMySqlDatabaseConnectionString("sys"));

            sysConnection.Open();
            cmdDb = new MySqlCommand($"create schema if not exists {dbName};", sysConnection);
            cmdDb.ExecuteNonQuery();
            sysConnection.Close();
        }