Thinker

Would you like to react to this message? Create an account in a few clicks or log in to continue.
Thinker

Forum for story


    【错误提示符】Updateing Record Failed

    Aueeins
    Aueeins
    呢喃的歌声


    帖子数 : 205
    积分 : 5229
    威望 : 0
    注册日期 : 2011-09-08
    地点 : SG

    【错误提示符】Updateing Record Failed Empty 【错误提示符】Updateing Record Failed

    Post by Aueeins 2011-09-27, 11:40 am

    Private Function pSqlUpdateRecord(ByVal sender As System.Object, ByVal e As System.EventArgs) As Boolean
    pSqlUpdateRecord = False

    ' Establish Connection
    Dim conn As New SqlConnection(vpConnStr)

    Try
    Dim strSql As String = " UPDATE m08Disb SET " & _
    " Code=@txtCode," & _
    " Module=@txtModule," & _
    " Type=@txtType ," & _
    " SubType=@txtSubType ," & _
    " Description=@txtDescription ," & _
    " Unit=@txtUnit ," & _
    " RateCost=@txtRateCost , " & _
    " RateBill=@txtRateBill, " & _
    " LedgerCost=@txtLedgerCost, " & _
    " LedgerBill=@txtLedgerBill ," & _
    " Gst=@txtGst , " & _
    " GstRate=@txtGstRate, " & _
    " Memo=@txtMemo, " & _
    " LastAddEditStaff=@txtLastAddEditStaff, " & _
    " LastAddEditDate=@txtLastAddEditDate " & _
    " WHERE SQLCode=@SQLCode "
    conn.Open()

    ' Create SQL Command
    Dim MyCommand As SqlCommand = conn.CreateCommand()
    MyCommand.CommandText = strSql

    ' Add Parameter
    MyCommand.Parameters.Add(New SqlParameter("@txtCode", SqlDbType.VarChar))
    MyCommand.Parameters.Add(New SqlParameter("@txtModule", SqlDbType.VarChar))
    MyCommand.Parameters.Add(New SqlParameter("@txtType", SqlDbType.VarChar))
    MyCommand.Parameters.Add(New SqlParameter("@txtSubType", SqlDbType.VarChar))
    MyCommand.Parameters.Add(New SqlParameter("@txtDescription", SqlDbType.VarChar))
    MyCommand.Parameters.Add(New SqlParameter("@txtUnit", SqlDbType.VarChar))
    MyCommand.Parameters.Add(New SqlParameter("@txtRateCost", SqlDbType.Decimal))
    MyCommand.Parameters.Add(New SqlParameter("@txtRateBill", SqlDbType.Decimal))
    MyCommand.Parameters.Add(New SqlParameter("@txtLedgerCost", SqlDbType.VarChar))
    MyCommand.Parameters.Add(New SqlParameter("@txtLedgerBill", SqlDbType.VarChar))
    MyCommand.Parameters.Add(New SqlParameter("@txtGst", SqlDbType.VarChar))
    MyCommand.Parameters.Add(New SqlParameter("@txtMemo", SqlDbType.VarChar))
    MyCommand.Parameters.Add(New SqlParameter("@txtGstRate", SqlDbType.Decimal))
    MyCommand.Parameters.Add(New SqlParameter("@txtLastAddEditStaff", SqlDbType.VarChar))
    MyCommand.Parameters.Add(New SqlParameter("@txtLastAddEditDate", SqlDbType.DateTime))
    MyCommand.Parameters.Add(New SqlParameter("@SQLCode", SqlDbType.Decimal))

    ' Set Parameter
    MyCommand.Parameters("@txtCode").Value = Me.txtCode.Text
    MyCommand.Parameters("@txtModule").Value = Me.txtModule.Text
    MyCommand.Parameters("@txtType").Value = Me.txtType.Text
    MyCommand.Parameters("@txtSubType").Value = Me.txtSubType.Text
    MyCommand.Parameters("@txtDescription").Value = Me.txtDescription.Text
    MyCommand.Parameters("@txtUnit").Value = Me.txtUnitMs.Text
    MyCommand.Parameters("@txtRateCost").Value = Val(Me.txtCostRate.Text)
    MyCommand.Parameters("@txtRateBill").Value = Val(Me.txtBillRate.Text)
    MyCommand.Parameters("@txtLedgerCost").Value = Me.txtCostLedger.Text
    MyCommand.Parameters("@txtLedgerBill").Value = Me.txtBillLedger.Text
    MyCommand.Parameters("@txtGst").Value = Me.txtGST.Text
    MyCommand.Parameters("@txtGstRate").Value = Val(Me.txtRate.Text)
    MyCommand.Parameters("@txtMemo").Value = Me.txtMemo.Text
    MyCommand.Parameters("@txtLastAddEditStaff").Value = vpStaffId
    MyCommand.Parameters("@txtLastAddEditDate").Value = Now
    MyCommand.Parameters("@SQLCode").Value = Val(Me.vEventCode)


    ' Execute SQL Query
    MyCommand.ExecuteNonQuery()
    pSqlUpdateRecord = True
    Catch ex As Exception
    MsgBox("<f08DisbEdit.pSqlUpdateRecord> " & ex.Message)
    Finally
    ' Close Connection
    If (conn.State = ConnectionState.Open) Then
    conn.Close()
    End If
    End Try
    End Function
    Aueeins
    Aueeins
    呢喃的歌声


    帖子数 : 205
    积分 : 5229
    威望 : 0
    注册日期 : 2011-09-08
    地点 : SG

    【错误提示符】Updateing Record Failed Empty Re: 【错误提示符】Updateing Record Failed

    Post by Aueeins 2011-11-09, 10:54 am

    If Not IsNumeric(e.KeyChar) And Not e.KeyChar = vbBack Then
    e.KeyChar = Nothing
    End If

      Current date/time is 2024-11-25, 4:54 pm