Below is the code to update gridview. In gridview, i m using dropdownlists, datepicker and text boxes in the update grid. I m getting all the value correct.. Main issue is i m not able to update Case_Status and Case_Type in the database. if i m updating then both values updated as NULL in database. I checked the values of V1 and V2 by using breakpoints in Visual Studio. Both values are desired result. but updating NULL...
On " GridView1.EditIndex = -1;" I am getting value 4 while checking through breakpoints..
con.Open();
SqlCommand cmd = new SqlCommand("UPDATE intakesheet SET case_number = @case_number, case_name = @case_name, Case_Type = @Case_Type, Case_Status = @Case_Status, assigned_date = @assigned_date, assigned_to = @assigned_to, date_withdrawn= @date_withdrawn, date_delivered= @date_delivered, qc_by = @qc_by, qc_date= @qc_date, additional_notes = @additional_notes WHERE (case_number = @case_number)", con);
cmd.Parameters.Add("@case_number", SqlDbType.NVarChar).Value = case_number;
cmd.Parameters.Add("@case_name", SqlDbType.NVarChar).Value = case_name;
cmd.Parameters.AddWithValue("@Case_Type", v1);
cmd.Parameters.AddWithValue("@Case_Status", v2);
cmd.Parameters.Add("@assigned_date", SqlDbType.NVarChar).Value = assigned_date;
cmd.Parameters.AddWithValue("@assigned_to", assigned_to);
cmd.Parameters.AddWithValue("@date_withdrawn", date_withdrawn);
cmd.Parameters.AddWithValue("@date_delivered", date_delivered);
cmd.Parameters.AddWithValue("@qc_by", qc_by);
cmd.Parameters.AddWithValue("@qc_date", qc_date);
cmd.Parameters.Add("@additional_notes", SqlDbType.NVarChar).Value = additional_notes;
cmd.ExecuteNonQuery();
GridView1.EditIndex = -1;
con.Close();
}