private void Грид() { string strsql = "SELECT * FROM Categories cat JOIN Goods g ON g.Category = cat.CategoryID"; DataTable ds = Подключение.Selects(strsql); dgr1.ItemsSource = ds.AsDataView(); }
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]); } }
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(); }
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(); }
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 }