Beispiel #1
0
        private void Грид()
        {
            string    strsql = "SELECT * FROM Categories cat JOIN Goods g ON g.Category = cat.CategoryID";
            DataTable ds     = Подключение.Selects(strsql);

            dgr1.ItemsSource = ds.AsDataView();
        }
Beispiel #2
0
        private void btn2_Click(object sender, RoutedEventArgs e)
        {
            string strsql = "SELECT ProductName FROM Goods";

            DataTable ds = Подключение.Selects(strsql);

            foreach (DataRow row in ds.Rows)
            {
                lst1.Items.Add(row[0]);
            }
        }
Beispiel #3
0
        private void btn2_Click(object sender, RoutedEventArgs e)
        {
            string strsql = "DELETE FROM Categories WHERE CategoryID=1";

            Под.Updates(strsql);

            string    strsql1 = "SELECT * FROM Categories cat JOIN Goods g ON g.Category = cat.CategoryID";
            DataTable ds      = Подключение.Selects(strsql1);

            dgr1.ItemsSource = ds.AsDataView();
        }
Beispiel #4
0
        private void btn3_Click(object sender, RoutedEventArgs e)
        {
            string PrName  = "Карамель";
            Double PrName1 = 25;
            int    PrName2 = 965;

            //string strsql = "SELECT * FROM Goods";

            string strsql = "INSERT INTO Goods(Category,ProductName,Price,Количество) VALUES (2,'" + PrName + "'," + PrName1 + "," + PrName2 + ")";

            Под.Updates(strsql);

            string    strsql1 = "SELECT * FROM Goods";
            DataTable ds      = Подключение.Selects(strsql1);

            grid1.ItemsSource = ds.AsDataView();
        }
Beispiel #5
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            string strsql = "SELECT ProductName FROM Goods";

            DataTable ds = Подключение.Selects(strsql);

            foreach (DataRow row in ds.Rows)
            {
                combobox1.Items.Add(row[0]);
            }
            //MessageBox.Show("Как то так");

            //Me.ComboBox4.AutoCompleteCustomSource.Clear()
            //Me.ComboBox4.Items.Clear()
            //For Each r As DataRow In ds.Rows
            //    Me.ComboBox4.AutoCompleteCustomSource.Add(r.Item(0).ToString())
            //    Me.ComboBox4.Items.Add(r(0).ToString)
            //Next
        }