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 ViewTableButton_Click(object sender, RoutedEventArgs e) { var sql = new NewSQLConn(); string q = ResultListBox.SelectedItem.ToString(); var addWindow = new AddTable() { Columns = sql.SelectCols(q) }; addWindow.TableNameBox.Text = ResultListBox.SelectedItem.ToString(); addWindow.ColumnsDataGrid.ItemsSource = addWindow.Columns; addWindow.ConfButton.Content = "Update"; addWindow.Show(); }
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(); }
public void UpdateResults() { var sql = new NewSQLConn(); ResultListBox.ItemsSource = sql.Select("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='dbo'", 2); }