I’m entering sales entries using a TabaleAdapter and a dataGridView. When a row is about to be saved, i want to check the StockBalance of the selected product and verify that current stock for selected product is not less than amount being sold. if its less i want to cancel the sale, so how can get the values that are about to be inserted or updated by the TableAdapter from the example code below?
private void dataGridView1_RowValidated(object sender, DataGridViewCellEventArgs e)
{
this.Validate();
this.itemSalesBindingSource.EndEdit();
this.itemSalesTableAdapter.Update(this.businessDataDataSet);
}
Try using this command before calling
Update(...):Now you should have a DataSet object that shows what is going to be transmitted to the database.