コード例 #1
0
        public void DropMySqlDatabase(string dbName)
        {
            MySqlConnection sysConnection = null;
            MySqlCommand    cmdDb         = null;

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

            sysConnection.Open();
            cmdDb = new MySqlCommand($"drop database if exists {dbName};", sysConnection);
            cmdDb.ExecuteNonQuery();
            sysConnection.Close();
        }
コード例 #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();
        }