- Back to Home »
- ADO.NET »
- Disconnected Architecture Update
Posted by :
Sudhir Chekuri
Saturday, 12 March 2016
//Disconnected - update
//Update product name based on the
product name under a category
private void BtnUpdateProduct_Click(object
sender, EventArgs e)
{
//SqlCommand to delete Product
SqlCommand cmd = new SqlCommand("exec Usp_UpdateProduct
'" +
CBExistingCategories.Text + "','" +
CBExistingProducts.Text + "','"+TxtUpdateProduct.Text+"'", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
//Update Products
PopulateProducts();
//Show first item
CBExistingProducts.SelectedIndex = 0;
MessageBox.Show("Product Updated
Successfully");
}
//Disconnected Update
//Update product details
private void BtnAddDetails_Click(object
sender, EventArgs e)
{
//exec Usp_AddProductDetails
'Drinks','Sprites','200 ml sprite chota bottle',25
//SqlCommand to delete Product
SqlCommand cmd = new SqlCommand("exec Usp_AddProductDetails
'" +
CBExistingCategories.Text + "','" +
CBExistingProducts.Text + "','" +
TxtDescription.Text + "',"+NudPrice.Value+"", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
MessageBox.Show("Product details added
Successfully");