Exemplo n.º 1
0
        private void clearButton_Click(object sender, EventArgs e)
        {
            try
            {
                var message = "Are you sure you want to clear the contents from the database?";
                var caption = "Clear Contents From Database";
                MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                DialogResult      result;

                result = MessageBox.Show(message, caption, buttons);

                if (result == DialogResult.Yes)
                {
                    var query = "DROP TABLE LoggerTable;";
                    dbQuery.Delete(query);
                    sqlDatabaseGridView.Rows.Clear();
                    sqlDatabaseGridView.Columns.Clear();
                    sqlDatabaseGridView.Refresh();
                    dbQuery.Create("CREATE TABLE IF NOT EXISTS LoggerTable (Extension TEXT, Filename TEXT, PATH TEXT, Event TEXT, DateTime TEXT);");
                }
            }catch (Exception exe)
            {
                Console.WriteLine(exe.Message);
            }
        }