Пример #1
0
        private void DeleteTableButton_Click(object sender, RoutedEventArgs e)
        {
            var conf = MessageBox.Show("Are you sure you want to remove this table and all its records?", "Confirm Opperation", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);

            if (conf == MessageBoxResult.Yes)
            {
                var sql = new NewSQLConn();

                sql.NonQuery("DROP TABLE " + ResultListBox.SelectedItem.ToString());
                UpdateResults();
            }
        }
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            var sql = new NewSQLConn();

            //Make col string
            string query = ("CREATE TABLE " + TableNameBox.Text + " (");

            foreach (ColumnType col in Columns)
            {
                if (col != Columns[0])
                {
                    query += ", " + col.Name + " " + col.Type;
                }
                else
                {
                    query += col.Name + " " + col.Type;
                }
            }
            query += ")";
            MessageBox.Show(query);
            sql.NonQuery(query);
            this.Close();
        }