I get this error when I click the submit button. It never came up before. How can I fix this?
Incorrect syntax near ')'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near ')'.
Source Error:
Line 180: //cmd.Parameters.AddWithValue("@accessLevel", TextBoxaccessLevel.Text);
Line 181:
Line 182: cmd.ExecuteNonQuery();
Line 183: con.Close();
Line 184:
Source File: Line: 182
Stack Trace:
[SqlException (0x80131904): Incorrect syntax near ')'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1767866
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5352418
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244
System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +269
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds) +1406
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +177
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean asyncWrite) +205
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +160
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +9752490
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +196
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +35
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724
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 (INST_ID, TOTAL_REVE, FINYR, DATE, INSTRUCTIO, RESEARCH, PUBLIC_SER, ACADEMIC_S, STUDENT_SE, INSTITUTIO, PHYSICAL_P, SCHOLARSHI, AUXILIARY_, HOSPITALS, INDEPENDEN, OTHEREXP, TOTASSETS, TOTLIABILITY, NoNEXPPERMRESASSETS, EXPENDABLE, UNRNETASSETS, TOTALREV, TUITFEES, CURRDEBT, LONGTERMDEBT,) values (@INST_ID, @TOTAL_REVE, @FINYR, @DATE, @INSTRUCTIO, @RESEARCH, @PUBLIC_SER, @ACADEMIC_S, @STUDENT_SE, @INSTITUTIO, @PHYSICAL_P, @SCHOLARSHI, @AUXILIARY_, @HOSPITALS, @INDEPENDEN, @OTHEREXP, @TOTASSETS, @TOTLIABILITY, @NoNEXPPERMRESASSETS, @EXPENDABLE, @UNRNETASSETS, @TOTALREV, @TUITFEES, @CURRDEBT, @LONGTERMDEBT, @TOTALNETASSETS)Insert into Table23 (INST_ID, TOTAL_REVE, FINYR, DATE, INSTRUCTIO, RESEARCH, PUBLIC_SER, ACADEMIC_S, STUDENT_SE, INSTITUTIO, PHYSICAL_P, SCHOLARSHI, AUXILIARY_, HOSPITALS, INDEPENDEN, OTHEREXP, TOTASSETS, TOTLIABILITY, NoNEXPPERMRESASSETS, EXPENDABLE, UNRNETASSETS, TOTALREV, TUITFEES, CURRDEBT, LONGTERMDEBT, TOTALNETASSETS) values (@INST_ID, @TOTAL_REVE, @FINYR, @DATE, @INSTRUCTIO, @RESEARCH, @PUBLIC_SER, @ACADEMIC_S, @STUDENT_SE, @INSTITUTIO, @PHYSICAL_P, @SCHOLARSHI, @AUXILIARY_, @HOSPITALS, @INDEPENDEN, @OTHEREXP, @TOTASSETS, @TOTLIABILITY, @NoNEXPPERMRESASSETS, @EXPENDABLE, @UNRNETASSETS, @TOTALREV, @TUITFEES, @CURRDEBT, @LONGTERMDEBT, @TOTALNETASSETS)", con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@INST_ID", TextBoxINST_ID.Text);
cmd.Parameters.AddWithValue("@TOTAL_REVE", TextBoxTROA.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("@SCHOLARSHI", TextBoxSFEDA.Text);
cmd.Parameters.AddWithValue("@AUXILIARY_", TextBoxAuxE.Text);
cmd.Parameters.AddWithValue("@HOSPITALS", TextBoxHosS.Text);
cmd.Parameters.AddWithValue("@INDEPENDEN", TextBoxIndeO.Text);
cmd.Parameters.AddWithValue("@OTHEREXP", TextBoxOED.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("@DATE", TextBoxDATE.Text);
cmd.Parameters.AddWithValue("@FINYR", TextBoxDATE2.Text);
cmd.Parameters.AddWithValue("@TOTALNETASSETS", TextBoxTNA.Text);
cmd.ExecuteNonQuery();
con.Close();