- Back to Home »
- ADO.NET »
- Disconnected Architecture Insert
Posted by :
Sudhir Chekuri
Saturday, 12 March 2016
//Disconnected Insert
//Adding product
private void BtnAddProduct_Click(object
sender, EventArgs e)
{
SqlConnection con =new SqlConnection (@"Data Source=DESKTOP-LEBFFH4\PRESS;Initial Catalog=STUDENT;Integrated Security=True");
SqlConnection con =new SqlConnection (@"Data Source=DESKTOP-LEBFFH4\PRESS;Initial Catalog=STUDENT;Integrated Security=True");
//SqlCommand to insert Product
SqlCommand cmd = new SqlCommand("exec Usp_InsertProduct
'" +
CBExistingCategories.Text + "','" +
TxtAddProduct.Text + "','" + TxtDescription.Text + "'," + NudPrice.Value+ "", con);
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
MessageBox.Show("Product Added
Successfully");