将Visual Basic中的今天日期与MS Access数据库中的日期进行比较

时间:2017-02-28 10:36:37

标签: vb.net visual-studio date oledb datareader

我在Access中使用的数据类型是“日期/时间”。我想知道如何在Access中提取日期并将其分配给变量,以便我可以比较它们。

这就是我现在拥有的。我将'curdate'设置为当前日期。我想做'curdate = dbdate'之类的事情,其中​​'dbdate'代表数据库中的日期。

Dim curdate As Date
curdate = Date.Now()

如何将其与存储在Access数据库中的日期进行比较?

非常感谢任何帮助!

cmdCheckFines.CommandText = "Select * From Fines Where MemberID = '" & (txtMemberID.Text) & "';"
        cmdLoanDetails.CommandText = "Select * From Loan Where MemberID = " & (txtMemberID.Text) & ";"

        cmdCheckFines.Connection = cmOLEDB
        cmdLoanDetails.Connection = cmOLEDB

        Dim LoanDetails As OleDbDataReader = cmdLoanDetails.ExecuteReader()
        Dim CheckFines As OleDbDataReader = cmdCheckFines.ExecuteReader()

        If CheckFines.Read = True And LoanDetails.Read = True Then

            Dim fines As Integer
            Dim curdate As Date
            Dim expiryduration As Date

            curdate = Date.Now()

0 个答案:

没有答案