标题:vb查询,出现“至少有一个没有被制定“
只看楼主
join窝窝
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2012-5-13
结帖率:100%
已结贴  问题点数:20 回复次数:1 
vb查询,出现“至少有一个没有被制定“
Private Sub cmdfind_Click()
    Dim sql As String
    ZhuCe_XueSheng.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
    ZhuCe_ = adCmdText
    If Option3.Value = True Then
        sql = "select * from xueji where xh like'" & Text6.Text & "'"
    End If
    If Option4.Value = True Then
        sql = "select * from xueji where xm like '" & "%" & Trim(Text7.Text) & "%" & "'"
    End If
   
    ZhuCe_XueSheng.RecordSource = sql
    ZhuCe_XueSheng.Refresh  ‘问题指向这里
   
   
    Set DataGrid1.DataSource = ZhuCe_XueSheng
End Sub
搜索更多相关主题的帖子: 查询 sql where 
2012-05-13 08:40
Artless
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:103
帖 子:4211
专家分:28888
注 册:2009-4-8
得分:20 
以下是引用join窝窝在2012-5-13 08:40:05的发言:

Private Sub cmdfind_Click()
    Dim sql As String
    ZhuCe_XueSheng.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
    ZhuCe_ = adCmdText
    If Option3.Value = True Then
        sql = "select * from xueji where xh like '" & Text6.Text & "'"
    End If
    If Option4.Value = True Then
        sql = "select * from xueji where xm like '" & "%" & Trim(Text7.Text) & "%" & "'"
    End If
   
    ZhuCe_XueSheng.RecordSource = sql
    ZhuCe_XueSheng.Refresh  ‘问题指向这里
   
   
    Set DataGrid1.DataSource = ZhuCe_XueSheng
End Sub

无知
2012-05-15 23:38



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




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

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