private void button2_Click(object sender, EventArgs e)
{
string constr = "Data Source=NOBEL-PC\\SQLEXPRESS;Initial Catalog=db_ecommerce;user id=rupak;password=rupak";
SqlConnection sqlcon = new SqlConnection(constr);
string product_name = textBox1.Text;
string product_description = richTextBox1.Text;
string query = "updateproduct";
SqlCommand scmd = new SqlCommand(query, sqlcon);
scmd.CommandType = CommandType.StoredProcedure;
scmd.Parameters.AddWithValue("@id",myid);
// MessageBox.Show(myid.ToString());
scmd.Parameters.AddWithValue("@names", product_name);
scmd.Parameters.AddWithValue("@description", richTextBox1.Text);
try
{
sqlcon.Open();
scmd.ExecuteNonQuery();
MessageBox.Show("Data Updated");
}
catch (SqlException se)
{
MessageBox.Show(se.Message);
}
sqlcon.Close();
}
No comments:
Post a Comment