private void SalesCRUD_Load(object sender, EventArgs e) { this.tblSalesTableAdapter.Fill(this.kitapSatisDataSet4.tblSales); Sales = DbSale.GetSales(); bindingSource.DataSource = Sales; gridViewSale.DataSource = bindingSource; }
private void btnSaleUpdate_Click(object sender, EventArgs e) { SqlCommand cmd = new SqlCommand(); connection.Open(); cmd.Connection = connection; cmd.CommandText = "UPDATE tblSales SET customerName='" + txtAd.Text + "',customerPhone='" + txtPhone.Text + "',customerAdress='" + txtAdress.Text + "', [Price]='" + txtPrice.Text + "' , [Order]='" + txtOrder.Text + "' WHERE TC=" + txtTC.Text + ""; cmd.ExecuteNonQuery(); connection.Close(); this.tblSalesTableAdapter.Fill(this.kitapSatisDataSet4.tblSales); Sales = DbSale.GetSales(); bindingSource.DataSource = Sales; gridViewSale.DataSource = bindingSource; }
private void btnSaleDelete_Click(object sender, EventArgs e) { try { SqlCommand cmd = new SqlCommand(); connection.Open(); cmd.Connection = connection; cmd.CommandText = "DELETE FROM tblSales WHERE TC=" + txtTC.Text + ""; cmd.ExecuteNonQuery(); connection.Close(); this.tblSalesTableAdapter.Fill(this.kitapSatisDataSet4.tblSales); Sales = DbSale.GetSales(); bindingSource.DataSource = Sales; gridViewSale.DataSource = bindingSource; } catch { MessageBox.Show(this, "Bir satış seçiniz", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }