Error when update file name
-
:sigh:I am trying to update my t_linkTitle which is the file name of the file that i have upload to webserver (sFile1. sFile12, sFile13). My code is as below. When i run my code, there is a incorrect syntax as below. Where have i did wrong? Syntax Error: -----------------------------------------------------------------------------Line 1: 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: Line 1: Incorrect syntax near ','. Source Error: Line 602: myconnection.Open() Line 603: mycommand.ExecuteNonQuery() Line 604: ' lblDelMsg.Text = "File Update successfully" Line 605: ' Catch Exp As SqlException Stack Trace: [SqlException (0x80131904): Line 1: Incorrect syntax near ','.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857354 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734966 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +149 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +415 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135 addCourseMaterial.bttnUpUpdate_ServerClick(Object sender, EventArgs e) in c:\inetpub\wwwroot\fyp\Admin\addCourseMaterial.aspx.vb:603 System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e) +105 System.Web.UI.HtmlControls.HtmlInputButton.RaisePostBackEvent(String eventArgument) +106 System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 Sys
-
:sigh:I am trying to update my t_linkTitle which is the file name of the file that i have upload to webserver (sFile1. sFile12, sFile13). My code is as below. When i run my code, there is a incorrect syntax as below. Where have i did wrong? Syntax Error: -----------------------------------------------------------------------------Line 1: 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: Line 1: Incorrect syntax near ','. Source Error: Line 602: myconnection.Open() Line 603: mycommand.ExecuteNonQuery() Line 604: ' lblDelMsg.Text = "File Update successfully" Line 605: ' Catch Exp As SqlException Stack Trace: [SqlException (0x80131904): Line 1: Incorrect syntax near ','.] System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857354 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +734966 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838 System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +149 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +415 System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135 addCourseMaterial.bttnUpUpdate_ServerClick(Object sender, EventArgs e) in c:\inetpub\wwwroot\fyp\Admin\addCourseMaterial.aspx.vb:603 System.Web.UI.HtmlControls.HtmlInputButton.OnServerClick(EventArgs e) +105 System.Web.UI.HtmlControls.HtmlInputButton.RaisePostBackEvent(String eventArgument) +106 System.Web.UI.HtmlControls.HtmlInputButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 Sys
LovelyHelp wrote:
, link_file2@File21, link_file3@File31
If you started with SET [field]=@parameter you cannot change values without assigning them.
-
LovelyHelp wrote:
, link_file2@File21, link_file3@File31
If you started with SET [field]=@parameter you cannot change values without assigning them.
yes i have my parameter mycommand.Parameters.Add("@txtUpTitle", SqlDbType.VarChar, 100).Value = txtUpTitle.Text mycommand.Parameters.Add("@txtUpLink", SqlDbType.VarChar, 100).Value = txtUpLink.Text mycommand.Parameters.Add("@File11", SqlDbType.VarChar, 100).Value = sFile1 mycommand.Parameters.Add("@File21", SqlDbType.VarChar, 100).Value = sFile12 mycommand.Parameters.Add("@File31", SqlDbType.VarChar, 100).Value = sFile13 but it still have the same error.
-
yes i have my parameter mycommand.Parameters.Add("@txtUpTitle", SqlDbType.VarChar, 100).Value = txtUpTitle.Text mycommand.Parameters.Add("@txtUpLink", SqlDbType.VarChar, 100).Value = txtUpLink.Text mycommand.Parameters.Add("@File11", SqlDbType.VarChar, 100).Value = sFile1 mycommand.Parameters.Add("@File21", SqlDbType.VarChar, 100).Value = sFile12 mycommand.Parameters.Add("@File31", SqlDbType.VarChar, 100).Value = sFile13 but it still have the same error.
is anyone can help?