protected void LinkButtonContacts_Click(object sender, EventArgs e)
{
string obj1 = TextBox6.Text.Trim();
string obj2 = TextBox7.Text.Trim();
string obj3 = TextBox8.Text.Trim();
string queryUpdate = "Update User_Objectives SET Objective1= @Objective1 , Objective2=@Objective2 ,Objective3=@Objective3 WHERE Email='useremail'";
SqlConnection con = new SqlConnection();
con.ConnectionString = @"Data Source=.\SQLEXPRESS;Initial Catalog=resume;Integrated Security=True";
SqlCommand cmd = new SqlCommand(queryUpdate, con);
cmd.Parameters.AddWithValue("@Objective1", TextBox6.Text);
cmd.Parameters.AddWithValue("@Objective2", TextBox7.Text);
cmd.Parameters.AddWithValue("@Objective3",TextBox8.Text );
int added = 0;
try
{
con.Open();
added = cmd.ExecuteNonQuery();
Label1.Text = added + "record inserted";
}
catch (Exception err)
{
Label1.Text = "error inserting record";
Label1.Text = Label1.Text + err.Message;
}
finally
{
con.Close();
}
问问题
28 次