First of all don't name your variables like conn1, cmd2, Label8, it's bad practice.
Many articles, chapters and so on have been written about it.
Also if there is no special reason for using single SqlCommand for entire class.
Convert string values to numeric, because:
object os = "5";
object on = 5;
are not same thing.
Use
try/catch/finally block and close connection there. If necessary read about it.
For your basic problem try this:
protected void update_Click(object sender, EventArgs e)
{
string updateQuery = "UPDATE Que1 SET que=@que, ans=@que_ans WHERE que_id=@que_id";
try
{
using(SqlCommand cmd = new SqlCommand(updateQuery , con))
{
cmd.Parameters.Add("@que_id",SqlDbType.Int).Value = int.Parse(Label5.Text);
cmd.Parameters.Add("@que",SqlDbType.VarChar).Value = TextBox1.Text;
cmd.Parameters.Add("@que_ans",SqlDbType.VarChar).Value = TextBox2.Text;
if(con.State != ConnectionState.Open)
{
con.Open();
}
cmd.ExecuteNonQuery();
Response.Write("changed");
TextBox1.Text = string.Empty;
TextBox2.Text = string.Empty;
}
}
catch (Exception ex)
{
Label3.Text = string.Format("Not updated successfully {0}",ex);
}
finally
{
if(con.State != ConnectionState.Closed)
{
con.Close();
}
}
}
I hope this helps.