进行月度交易

时间:2016-12-12 07:03:07

标签: vb.net access

我需要有关如何使用Ms Access在Visual Basic 2010中每月执行此代码的帮助。我试图设定月度日期,但我只能设定特定的月份。我希望它像一个银行系统,每个星期都执行它。

Public Sub Withdraw

    If myConnection.State = ConnectionState.Closed Then
        myConnection.Open()
    End If

    str = "insert into [Transactions] ([TransactionID],[EmployeeID], [AccountNumber], [TransDate], [Description], [Debit], [Balance], [Time]) values (?, ?, ?, ?, ?, ?, ?, ?)"
    Dim cmd As OleDbCommand = New OleDbCommand(str, myConnection)

    cmd.Parameters.Add(New OleDbParameter("TransactionID", CType(TNumber, String)))
    cmd.Parameters.Add(New OleDbParameter("EmployeeID", CType(OveralEmployeeID, String)))
    cmd.Parameters.Add(New OleDbParameter("AccountNumber", CType(AccountNumberTextBox.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("TransDate", CType(CurrentDate, String)))
    cmd.Parameters.Add(New OleDbParameter("Description", CType("Withdraw     WD - " + TNumber, String)))
    cmd.Parameters.Add(New OleDbParameter("Debit", CType(WithdrawAmountTextBox.Text, String)))
    cmd.Parameters.Add(New OleDbParameter("Balance", CType(GetBalance(), String)))
    cmd.Parameters.Add(New OleDbParameter("Time", CType(CurrentTime, String)))
          Try
        cmd.ExecuteNonQuery()
        cmd.Dispose()
        myConnection.Close()
        ClearGroupBox()
        AccountNumberTextBox.Text = Nothing
        MsgBox("Withdraw Reorded")
    Catch ex As Exception
        MsgBox(ex.Message)
    End Try
End Sub

0 个答案:

没有答案