标题:vb 提示:日期语法错误,大家快来帮帮忙
取消只看楼主
拉萨
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2014-5-16
结帖率:0
已结贴  问题点数:20 回复次数:1 
vb 提示:日期语法错误,大家快来帮帮忙
找了好久,实在找不到哪不对,这是一个窗口的代码

VB提示:日期语法错误,在查询表达式'应还日期=#2014/5/16星期五#'中
源代码:
Private Sub Command1_Click()
    frmmain.Timer1.Enabled = False
    Unload Me
End Sub

Private Sub Command2_Click()
 Adodc1.RecordSource = "select * from dzjstb where  应还日期<" & Chr(35) & DT1 & Chr(35) & ""
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
        Set DataGrid1.DataSource = Adodc1
        DataGrid1.Refresh
    End If
    Adodc2.RecordSource = "select * from dzjstb where 应还日期=" & Chr(35) & DT1 & Chr(35) & ""
    Adodc2.Refresh
    If Adodc2.Recordset.RecordCount > 0 Then
        Set DataGrid2.DataSource = Adodc2
        DataGrid2.Refresh
    End If
End Sub

Private Sub DataGrid1_Error(ByVal DataError As Integer, Response As Integer)
    Response = 0
End Sub

Private Sub DataGrid2_Click()

End Sub

Private Sub DT1_Change()
    Adodc1.RecordSource = "select * from dzjstb where  应还日期= " & Chr(35) & DT1 & Chr(35) & ""
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
        DataGrid1.Refresh
    End If
    Adodc2.RecordSource = "select * from dzjstb where 应还日期 =" & Chr(35) & DT1 & Chr(35) & ""
    Adodc2.Refresh
    If Adodc2.Recordset.RecordCount > 0 Then
        DataGrid2.Refresh
    End If
End Sub

Private Sub Form_Activate()
    Adodc1.ConnectionString = cnn.ConnectionString
    Adodc2.ConnectionString = cnn.ConnectionString
    Adodc1.RecordSource = "select * from dzjstb where  应还日期 =" & Chr(35) & DT1 & Chr(35) & ""
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then
        Set DataGrid1.DataSource = Adodc1
        DataGrid1.Refresh
    End If
    Adodc2.RecordSource = "select * from dzjstb where 应还日期 =" & Chr(35) & DT1 & Chr(35) & ""
    Adodc2.Refresh
    If Adodc2.Recordset.RecordCount > 0 Then
        Set DataGrid2.DataSource = Adodc2
        DataGrid2.Refresh
    End If
End Sub
Private Sub Form_Load()
    DT1.Value = Date
    Me.Caption = Me.Caption & "     " & frmmain.StatusBar1.Panels(2).Text
End Sub

Private Sub SSTab1_DblClick()

End Sub
搜索更多相关主题的帖子: 源代码 表达式 False where 
2014-05-16 10:13
拉萨
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2014-5-16
得分:0 
回复 2 楼 lowxiong
源代码里没有日期格式,是不是要到数据库了找
2014-05-17 08:43



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-431616-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.256775 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved