示例#1
0
        private void btnKillDb_Click(object sender, EventArgs e)
        {
            try
            {
                var connectionString = GetConnectionString();

                if (string.IsNullOrWhiteSpace(connectionString))
                    return;

                _db = new MonetDatabase(connectionString);

                if (_db.StatusDatabase() == DatabaseStatus.None)
                {
                    MessageBox.Show(@"Database is not exists", @"Database", MessageBoxButtons.OK, MessageBoxIcon.Stop);

                    return;
                }

                _db.KillDatabase();

                LoggerHelper.Write(LoggerOption.Warning, "Database {0} killed", _db.ConnectionInfo.Database);
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, @"Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);

                LoggerHelper.Write(LoggerOption.Error, "Error: {0}", exp.Message);
            }
        }