I have a web form that has a saved button and a couple of textboxes on it. The user can enter data into the textboxes and save it to the database temporary. The user can come back to the web form and the saved data is populated back into the textboxes. The user wants to change the data in the populated textbox but can't. The data changes back to what was populated from the database. I have a SQL Delete statement in place but it doesn't seem to work. What did I do wrong?
Here is the populated code with Delete Statement:
if (TextBoxINST_ID.Text.Trim().Length > 0)
{
SqlConnection con44 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["HotConnectionString"].ConnectionString);
con44.Open();
SqlCommand scmd44 = new SqlCommand("Select FT_UNDERGR, FT_GRAD, FTE_UNDERG, FTE_GRAD, NON_CREDIT, TOTAL_FTE, FCFTUHC, FCFTPBHC, FCPTUHC, FCPTPBHC, NCHC from TableSave where INST_ID = '" + TextBoxINST_ID.Text + "'", con44);
SqlDataReader dr44 = scmd44.ExecuteReader();
if (dr44.Read())
{
TextBoxFTUG.Text = dr44["FT_UNDERGR"].ToString();
TextBoxFTG.Text = dr44["FT_GRAD"].ToString();
TextBoxTHUGDR.Text = dr44["FTE_UNDERG"].ToString();
TextBoxTHGDR.Text = dr44["FTE_GRAD"].ToString();
TextBoxNCCDR.Text = dr44["NON_CREDIT"].ToString();
TextBoxTCNC.Text = dr44["TOTAL_FTE"].ToString();
TextBoxTNFUG.Text = dr44["FCFTUHC"].ToString();
TextBoxTNFG.Text = dr44["FCFTPBHC"].ToString();
TextBoxTNCPUG.Text = dr44["FCPTUHC"].ToString();
TextBoxTNCPG.Text = dr44["FCPTPBHC"].ToString();
TextBoxTNNCC.Text = dr44["NCHC"].ToString();
TextBoxTNFUG.Text = string.Format("{0:0,0}", double.Parse(TextBoxTNFUG.Text));
TextBoxTNFG.Text = string.Format("{0:0,0}", double.Parse(TextBoxTNFG.Text));
TextBoxTNCPUG.Text = string.Format("{0:0,0}", double.Parse(TextBoxTNCPUG.Text));
TextBoxTNCPG.Text = string.Format("{0:0,0}", double.Parse(TextBoxTNCPG.Text));
TextBoxTNNCC.Text = string.Format("{0:0,0}", double.Parse(TextBoxTNNCC.Text));
TextBoxFTUG.Text = string.Format("{0:0,0}", double.Parse(TextBoxFTUG.Text));
TextBoxFTG.Text = string.Format("{0:0,0}", double.Parse(TextBoxFTG.Text));
TextBoxTHUGDR.Text = string.Format("{0:0,0}", double.Parse(TextBoxTHUGDR.Text));
TextBoxTHGDR.Text = string.Format("{0:0,0}", double.Parse(TextBoxTHGDR.Text));
TextBoxNCCDR.Text = string.Format("{0:0,0}", double.Parse(TextBoxNCCDR.Text));
TextBoxTCNC.Text = string.Format("{0:0,0}", double.Parse(TextBoxTCNC.Text));
ButtonSubmit.Visible = true;
ButtonPrint.Visible = false;
ButtonSave.Visible = false;
}
con44.Close();
dr44.Close();
if (TextBoxINST_ID.Text.Trim().Length > 0)
{
SqlConnection con45 = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["HotConnectionString"].ConnectionString);
con45.Open();
{
SqlCommand scmd45 = new SqlCommand("Delete FT_UNDERGR, FT_GRAD, FTE_UNDERG, FTE_GRAD, NON_CREDIT, TOTAL_FTE, FCFTUHC, FCFTPBHC, FCPTUHC, FCPTPBHC, NCHC from TableSave where INST_ID = '" + TextBoxINST_ID.Text + "'", con45);
ButtonPrint.Visible = false;
}
con45.Close();
}
}
}
}