保存记录太sql数据库

时间:2014-10-08 10:16:57

标签: sql database save records

嘿我的保存按钮有问题我试图将新动作保存到sql数据库中的动作表但是我得到单独的错误一个是转换字符串到类型整数是无效的,这是为.ActionTypeID = cmbActionType.SelectedValue这是一个下拉列表但是在数据库中是一个lookup_table而另一个是@Member是预期的并且没有给出我认为我用这行代码ActionLoadRecordsBindingSource.Filter = "MemberID = " & lblMemberIDValue.Text做了这个但是它似乎没有用,下面是我的代码......有什么想法吗?

Private Sub tsbSaveAction_Click(sender As Object, e As EventArgs) Handles tsbSaveAction.Click

    ' Error Checking
    On Error GoTo Err_tsbSaveAction_Click

    With objAction
        .ActionID = lblActionID.Text
        .ActionDateTime = dtpActionDateTime.Value
        .ActionTypeID = cmbActionType.SelectedValue
        .Notes = txtNotes.Text
        If .SaveAction = True Then
            MsgBox("Action Data saved successfully", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "AztecCRM - Member Action")
            pnlPayments.Enabled = False
            nudSubscriptionYear.Value = Year(Now)
            dtpPaymentDate.Value = Now
            cmbPaymentMethod.SelectedIndex = 0
            txtAmount.Text = ""
            txtReference.Text = ""
            tsbSavePayment.Enabled = False
            ActionLoadRecordsBindingSource.Filter = "MemberID = " & lblMemberIDValue.Text
            Me.Action_LoadRecordsTableAdapter.Fill(Me._ICOM_Actions.Action_LoadRecords)

        End If
    End With

Err_tsbSaveAction_Click:
    If Err.Number <> 0 Then
        sErrDescription = Err.Description
        WriteAuditLogRecord(Me.Name, "tsbSaveAction_Click", "Error", sErrDescription)
        MsgBox("System Error occurred" & Chr(13) & "tsbSaveAction_Click" & Chr(13) & sErrDescription, MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "AztecCRM - Error Reporting")
    End If

End Sub

0 个答案:

没有答案