Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Error when update file name

Error when update file name

Scheduled Pinned Locked Moved ASP.NET
designdata-structuresdebugginghelpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    LovelyHelp
    wrote on last edited by
    #1

    :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

    A 1 Reply Last reply
    0
    • L LovelyHelp

      :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

      A Offline
      A Offline
      Albert Pascual
      wrote on last edited by
      #2

      LovelyHelp wrote:

      , link_file2@File21, link_file3@File31

      If you started with SET [field]=@parameter you cannot change values without assigning them.

      L 1 Reply Last reply
      0
      • A Albert Pascual

        LovelyHelp wrote:

        , link_file2@File21, link_file3@File31

        If you started with SET [field]=@parameter you cannot change values without assigning them.

        L Offline
        L Offline
        LovelyHelp
        wrote on last edited by
        #3

        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.

        L 1 Reply Last reply
        0
        • L LovelyHelp

          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.

          L Offline
          L Offline
          LovelyHelp
          wrote on last edited by
          #4

          is anyone can help?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups