Exemplo n.º 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();
     }
 }
Exemplo n.º 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();
        }