object upt;
myconn.Open();
mycmd = new SqlCommand("sel ect CId from customer where CId='" + TextBox1.Text + "'", myconn);
upt= mycmd.ExecuteSc alar();
string up = Convert.ToStrin g(upt);
if (up == TextBox1.Text)
{
Label7.Text = "Row is Updated";
}
else
{
Label7.Text = "Row is not Updated";
}
mycmd = new SqlCommand("upd ate customer set CName='" + TextBox2.Text + "',CAddress ='" + TextBox3.Text + "',CPhone=' " + TextBox4.Text + "',CEmail=' " + TextBox5.Text + "',CCCardNo ='" + TextBox6.Text + "'where CId='"+TextBox1 .Text+"'", myconn);
mycmd.ExecuteNo nQuery();
myconn.Close();
display();
clear();
i write this code in button click event.When data is updated,
label shows "Row is not Updated". But actually it has to show "Row is Updated" msg.
But record is updated. It is showing msg only wrong. Please give me a
solution for this ASAP. Though condition is correct, it jumped to else. I'm getting confused. Anybody please help me.
myconn.Open();
mycmd = new SqlCommand("sel ect CId from customer where CId='" + TextBox1.Text + "'", myconn);
upt= mycmd.ExecuteSc alar();
string up = Convert.ToStrin g(upt);
if (up == TextBox1.Text)
{
Label7.Text = "Row is Updated";
}
else
{
Label7.Text = "Row is not Updated";
}
mycmd = new SqlCommand("upd ate customer set CName='" + TextBox2.Text + "',CAddress ='" + TextBox3.Text + "',CPhone=' " + TextBox4.Text + "',CEmail=' " + TextBox5.Text + "',CCCardNo ='" + TextBox6.Text + "'where CId='"+TextBox1 .Text+"'", myconn);
mycmd.ExecuteNo nQuery();
myconn.Close();
display();
clear();
i write this code in button click event.When data is updated,
label shows "Row is not Updated". But actually it has to show "Row is Updated" msg.
But record is updated. It is showing msg only wrong. Please give me a
solution for this ASAP. Though condition is correct, it jumped to else. I'm getting confused. Anybody please help me.