Results 1 to 6 of 6

Thread: [RESOLVED] Update of Production Record failed : Incorrect syntax near '('.

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2007
    Posts
    134

    Resolved [RESOLVED] Update of Production Record failed : Incorrect syntax near '('.

    Hello,

    Could anyone please examine this code please and help with detecting the problem please???




    Code:
        Dim query As String = "Update PRODUCTION Set(VENDORID,TCAPONUMBER,DATEOUT,DATEREQUIRED,TOTALCOST,TOTALQUANTITY,APPROVEDBY,PREPAREDBY) VALUE(@VENDORID,@TCAPO ,@DATEOUT,@DATEREQUIRED,@TOTALCOST,@TOTALQUANTITY,@APPROVEDBY,@PREPAREDBY)WHERE PRODUCTIONID = @PRODUCTIONID"
    
            Dim Conn As SqlConnection = New SqlConnection(connectionString)
            Try
                Conn.Open()
                Dim command As SqlCommand = New SqlCommand(query, Conn)
                ' Add the parameters for the UpdateCommand.
                With command.Parameters
                    ' Add the parameters for the UpdateCommand. 
                    .Add(New SqlParameter("@TCAPO", SqlDbType.Int, 4)).Value = TCAPO
                    .Add(New SqlParameter("@DATEOUT", SqlDbType.DateTime, 8)).Value = DateOut
                    .Add(New SqlParameter("@DATEREQUIRED", SqlDbType.DateTime, 8)).Value = DateRequired
                    .Add(New SqlParameter("@TOTALCOST", SqlDbType.SmallMoney, 5)).Value = TotalCost
                    .Add(New SqlParameter("@TOTALQUANTITY", SqlDbType.Int, 4)).Value = TotalQuantity
                    .Add(New SqlParameter("@PREPAREDBY", SqlDbType.VarChar, 50)).Value = PreParedBy
                    .Add(New SqlParameter("@APPROVEDBY", SqlDbType.VarChar, 50)).Value = ApprovedBy
                    .Add(New SqlParameter("@VENDORID", SqlDbType.Int, 4)).Value = vendorID
                    .Add(New SqlParameter("@PRODUCTIONID", SqlDbType.Int, 4)).Value = ProductionID
                    '.Add(New SqlParameter("@TCAPO", SqlDbType.Int, 4)).Value = TCAPO
                End With
                command.ExecuteNonQuery()
            Catch e As Exception
                Throw New Exception("Update of Production Record failed : " & e.Message)
                Return False
            Finally
                'make sure the Connection is always closed
                Conn.Close()
            End Try
    Last edited by Reaction; May 20th, 2007 at 09:34 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width