I have a form that takes data and inserts it into three databases when the submit button is clicked. When a user clicks the submit button there are two inserts in two of the tables where there should be one insert per table. The last table is not getting any data at all. What did I do wrong?
protected void ButtonSubmit_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["HotConnectionString"].ConnectionString);
con.Open();
SqlCommand cmd = new SqlCommand("Insert into Table22 (USERID, TOTAL_REVE, DATE, FINYR, INSTRUCTIO, RESEARCH, PUBLIC_SER, ACADEMIC_S, STUDENT_SE, INSTITUTIO, PHYSICAL_P, NET_AID, AUXILIARY_, HOSPITALS, INDEPENDEN, OTHEREXP, TOTASSETS, TOTLIABILITY, NoNEXPPERMRESASSETS, EXPENDABLE, UNRNETASSETS, TOTALREV, TUITFEES, CURRDEBT, LONGTERMDEBT, TOTALNETASSETS) values (@USERID, @TOTAL_REVE, @DATE, @FINYR, @INSTRUCTIO, @RESEARCH, @PUBLIC_SER, @ACADEMIC_S, @STUDENT_SE, @INSTITUTIO, @PHYSICAL_P, @NET_AID, @AUXILIARY_, @HOSPITALS, @INDEPENDEN, @OTHEREXP, @TOTASSETS, @TOTLIABILITY, @NoNEXPPERMRESASSETS, @EXPENDABLE, @UNRNETASSETS, @TOTALREV, @TUITFEES, @CURRDEBT, @LONGTERMDEBT, @TOTALNETASSETS)Insert into Table23 (USERID, TOTAL_REVE, DATE, FINYR, INSTRUCTIO, RESEARCH, PUBLIC_SER, ACADEMIC_S, STUDENT_SE, INSTITUTIO, PHYSICAL_P, NET_AID, AUXILIARY_, HOSPITALS, INDEPENDEN, OTHEREXP, TOTASSETS, TOTLIABILITY, NoNEXPPERMRESASSETS, EXPENDABLE, UNRNETASSETS, TOTALREV, TUITFEES, CURRDEBT, LONGTERMDEBT, TOTALNETASSETS) values (@USERID, @TOTAL_REVE, @DATE, @FINYR, @INSTRUCTIO, @RESEARCH, @PUBLIC_SER, @ACADEMIC_S, @STUDENT_SE, @INSTITUTIO, @PHYSICAL_P, @NET_AID, @AUXILIARY_, @HOSPITALS, @INDEPENDEN, @OTHEREXP, @TOTASSETS, @TOTLIABILITY, @NoNEXPPERMRESASSETS, @EXPENDABLE, @UNRNETASSETS, @TOTALREV, @TUITFEES, @CURRDEBT, @LONGTERMDEBT, @TOTALNETASSETS)Insert into Table24 (USERID, FirstName, MiddleName, LastName, Prefix, Suffix, Salutation, Title, Address1, Address2, City, State, Zip, Country, Phone, Fax, Email, DATE, accessLevel) values (@USERID, @FirstName, @MiddleName, @LastName, @Prefix, @Suffix, @Salutation, @Title, @Address1, @Address2, @City, @State, @Zip, @Country, @Phone, @Fax, @Email, @DATE, @accessLevel)", con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@TOTAL_REVE", TextBoxTRIR.Text);
cmd.Parameters.AddWithValue("@USERID", TextBoxUSERID.Text);
cmd.Parameters.AddWithValue("@INSTRUCTIO", TextBoxInstr.Text);
cmd.Parameters.AddWithValue("@RESEARCH", TextBoxRes.Text);
cmd.Parameters.AddWithValue("@PUBLIC_SER", TextBoxPubS.Text);
cmd.Parameters.AddWithValue("@ACADEMIC_S", TextBoxAcad.Text);
cmd.Parameters.AddWithValue("@STUDENT_SE", TextBoxStudS.Text);
cmd.Parameters.AddWithValue("@INSTITUTIO", TextBoxInstiS.Text);
cmd.Parameters.AddWithValue("@PHYSICAL_P", TextBoxOperM.Text);
cmd.Parameters.AddWithValue("@NET_AID", TextBoxNGAS.Text);
cmd.Parameters.AddWithValue("@AUXILIARY_", TextBoxAuxE.Text);
cmd.Parameters.AddWithValue("@HOSPITALS", TextBoxHosS.Text);
cmd.Parameters.AddWithValue("@INDEPENDEN", TextBoxIndeO.Text);
cmd.Parameters.AddWithValue("@OTHEREXP", TextBoxOE.Text);
cmd.Parameters.AddWithValue("@TOTASSETS", TextBoxTA.Text);
cmd.Parameters.AddWithValue("@TOTLIABILITY", TextBoxTL.Text);
cmd.Parameters.AddWithValue("@NoNEXPPERMRESASSETS", TextBoxNPRNA.Text);
cmd.Parameters.AddWithValue("@EXPENDABLE", TextBoxETRNA.Text);
cmd.Parameters.AddWithValue("@UNRNETASSETS", TextBoxTUNA.Text);
cmd.Parameters.AddWithValue("@TOTALREV", TextBoxTR.Text);
cmd.Parameters.AddWithValue("@TUITFEES", TextBoxTFN.Text);
cmd.Parameters.AddWithValue("@CURRDEBT", TextBoxCD.Text);
cmd.Parameters.AddWithValue("@LONGTERMDEBT", TextBoxLTD.Text);
cmd.Parameters.AddWithValue("@TOTALNETASSETS", TextBoxTNA.Text);
cmd.Parameters.AddWithValue("@FINYR", TextBoxDATE2.Text);
cmd.Parameters.AddWithValue("@DATE", TextBoxDATE.Text);
cmd.Parameters.AddWithValue("@FirstName", TextBoxFName.Text);
cmd.Parameters.AddWithValue("@LastName", TextBoxLName.Text);
cmd.Parameters.AddWithValue("@MiddleName", TextBoxMName.Text);
cmd.Parameters.AddWithValue("@Prefix", TextBoxPrefix.Text);
cmd.Parameters.AddWithValue("@Suffix", TextBoxSuffix.Text);
cmd.Parameters.AddWithValue("@Salutation", TextBoxSal.Text);
cmd.Parameters.AddWithValue("@Title", TextBoxTitle.Text);
cmd.Parameters.AddWithValue("@Address1", TextBoxMA1.Text);
cmd.Parameters.AddWithValue("@Address2", TextBoxMA2.Text);
cmd.Parameters.AddWithValue("@City", TextBoxCity.Text);
cmd.Parameters.AddWithValue("@State", TextBoxState.Text);
cmd.Parameters.AddWithValue("@Zip", TextBoxZip.Text);
cmd.Parameters.AddWithValue("@Country", TextBoxCoun.Text);
cmd.Parameters.AddWithValue("@Phone", TextBoxTN.Text);
cmd.Parameters.AddWithValue("@Fax", TextBoxFN.Text);
cmd.Parameters.AddWithValue("@Email", TextBoxEA.Text);
cmd.Parameters.AddWithValue("@accessLevel", TextBoxaccessLevel.Text);
cmd.ExecuteNonQuery();
con.Close();