コード例 #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();
            }
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        public void UpdateResults()
        {
            var sql = new NewSQLConn();

            ResultListBox.ItemsSource = sql.Select("SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='dbo'", 2);
        }