**fetch the record from the datsbase through specified query string **
 public void get_student()
            int id = Int32.Parse(Request.QueryString["empId"]);
            sql = new SqlConnection(con);
            string retriew = "select * from emp where emp_id="+id;
            SqlDataAdapter adapter = new SqlDataAdapter(retriew, sql);
            adapter.SelectCommand.CommandType = CommandType.Text;
            hfid.Value = id.ToString();
            DataTable dt = new DataTable();
            emp_name.Text = dt.Rows[0]["emp_name"].ToString();
            emp_age.Text = dt.Rows[0]["emp_age"].ToString();
            emp_email.Text = dt.Rows[0]["emp_email"].ToString();
            emp_phone.Text = dt.Rows[0]["emp_phone"].ToString();
            Button1.Text = "Update";
        PropertyInfo isreadonly =typeof(System.Collections.Specialized.NameValueCollection)                 .GetProperty("IsReadOnly", BindingFlags.Instance | BindingFlags.NonPublic);
        // make collection editable
        isreadonly.SetValue(this.Request.QueryString, false, null);
        // remove
        **after fetching the records i want to update the record but it is not updating.code is             executing successfully and no error is genereteding**
        protected void Button1_Click(object sender, EventArgs e)
            int id = Int32.Parse(hfid.Value);
            sql = new SqlConnection(con);
            string update = "update emp set emp_name='" + emp_name.Text + "',emp_age='" + emp_age.Text + "',emp_email='" + emp_email.Text + "',emp_phone='" + emp_phone.Text + "' where emp_id=" + id;
            SqlCommand cmd = new SqlCommand(update, sql);
            cmd.CommandType = CommandType.Text;
            cmd.Parameters.Add("emp_name", SqlDbType.VarChar).Value = emp_name.Text;
            cmd.Parameters.Add("emp_age", SqlDbType.VarChar).Value = emp_age.Text;
            cmd.Parameters.Add("emp_email", SqlDbType.VarChar).Value = emp_email.Text;
            cmd.Parameters.Add("emp_phone", SqlDbType.VarChar).Value = emp_phone.Text;

And you posted this because....

Usually when someone is having a problem with their code they go to the trouble of describing the problem, including any error messages, etc., in other words, putting in a little effort.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.