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




Reply With Quote