I am currently trying to update a database using C#
My issue is that the update query is not working, there is no error produced just reloads the screen and thats it.
My C# is as follows
void SaveRecords()
{
try
{
String qry = "Update Ordered_Test Set Ref_Phy = @Ref_Phy, Ord_Phy = @Ord_Phy, Location = @Location, Verified = @Verified, IOS =@IOS, Tech =@Tech, TapeNum =@TapeNum Where Ordered_T = @Ordered_T";
com.Open();
SqlCommand con = new SqlCommand(qry, com);
con.Parameters.AddWithValue("@Ordered_T", Label22.Text.Trim());
con.Parameters.AddWithValue("@Ref_Phy ", DropDownList2.Text.Trim());
con.Parameters.AddWithValue("@Ord_Phy ", DropDownList7.Text.Trim());
con.Parameters.AddWithValue("@Location ", DropDownList1.Text.Trim());
con.Parameters.AddWithValue("@Verified ", DropDownList6.Text.Trim());
con.Parameters.AddWithValue("@IOS", IOS.Text.Trim());
con.Parameters.AddWithValue("@Tech", DropDownList5.Text.Trim());
con.Parameters.AddWithValue("@TapeNum", TextBox2.Text.Trim());
con.ExecuteNonQuery();
}
finally
{
com.Close();
}
}
The "SaveRecords" function is getting called by another function which calls multiple other functions on button click
protected void SaveAll(object sender, EventArgs e)
{
signer();
SaveRecords();
deletePvalue();
deleteVvalue();
deleteAvalue();
deletevalue();
AddPNote();
AddVNote();
AddAVNote();
AddImpressionNote();
ReportReader();
SearchData();
ImpressionReader1();
ImpressionReader2();
ImpressionReader3();
ImpressionReader4();
ImpressionReader5();
ImpressionReader6();
}