我在MS Access中的数据类型是日期和时间我的错误是错误匹配数据类型

时间:2015-06-20 03:53:49

标签: vb.net ms-access

我的数据库中的数据类型是日期/时间

我的错误是数据类型错误匹配

请帮助tnx ...

            Dim try3 As String
            cmd1 = "SELECT count(new) AS cnew FROM sheet WHERE empname =  '" & try3 & "' AND new IS NOT NULL"
            cmd2 = "SELECT count(rev1) AS crev1 FROM sheet WHERE empname =  '" & try3 & "' AND rev1 <> '" & try2 & "' "
            cmd3 = "SELECT count(rev2) AS crev2 FROM sheet WHERE empname =  '" & try3 & "' AND rev2 <> '" & try2 & "' "
            cmd4 = "SELECT count(rev3) AS crev3 FROM sheet WHERE empname =  '" & try3 & "' AND rev3 <> '" & try2 & "' "
            cmd5 = "SELECT count(rev4) AS crev4 FROM sheet WHERE empname =  '" & try3 & "' AND rev4 <> '" & try2 & "' "
            cmd6 = "SELECT count(rev5) AS crev5 FROM sheet WHERE empname = '" & try3 & "' AND rev5 <> '" & try2 & "' "

1 个答案:

答案 0 :(得分:0)

如果try2是您的日期变量,则应显示为:

AND rev1 <> #" & try2.ToString("yyyy'/'mm'/'dd") & "# "