| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 905 人关注过本帖
标题:加一个什么样的条件才能执行到else处??
只看楼主 加入收藏
yuyuer
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2008-9-26
收藏
 问题点数:0 回复次数:2 
加一个什么样的条件才能执行到else处??
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim db As New ADOX.Catalog
Private Sub Command2_Click()
   '打开记录集
    Set MSHFlexGrid1.DataSource = rs
   
     rs.Close
    con.Close
End Sub

Private Sub Command3_Click()
Dim s1 As String
Dim s2 As String
Dim s As String
Dim aa As Boolean
If Text1.Text = "" Then
    MsgBox "不能为空", vbCritical, "不能为空"
    Exit Sub
Else
    s1 = "select * from bookitems"
    s2 = s1 & " where ÊéºÅ = '" & Text1.Text & "'"
        Set rs2 = con.Execute(s2)
        
       If rs2.RecordCount > 0 Then
       'Print rs2.RecordCount
    'If (s = "rs2.Fields!书号='" & Text1.Text & "'") Then
        Set MSHFlexGrid2.DataSource = rs2

        MSHFlexGrid2.Refresh
     Else       MsgBox "没有所查的记录", vbExclamation, "没有记录"
     End If
End If
搜索更多相关主题的帖子: else 条件 什么样 
2008-11-20 09:13
yuyuer
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2008-9-26
收藏
得分:0 
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Dim db As New ADOX.Catalog
Private Sub Command2_Click()
   '´ò¿ª¼Ç¼¼¯
    Set MSHFlexGrid1.DataSource = rs
   
     rs.Close
    con.Close
End Sub

Private Sub Command3_Click()
Dim s1 As String
Dim s2 As String
Dim s As String
Dim aa As Boolean
If Text1.Text = "" Then
    MsgBox "²éѯ²»ÄÜΪ¿Õ", vbCritical, Find
    Exit Sub
Else
    s1 = "select * from bookitems"
    s2 = s1 & " where ÊéºÅ = '" & Text1.Text & "'"
        Set rs2 = con.Execute(s2)
        
        If rs2.RecordCount > 0 Then
       'Print rs2.RecordCount
    'If (s = "rs2.Fields!ÊéºÅ='" & Text1.Text & "'") Then
        Set MSHFlexGrid2.DataSource = rs2

        MSHFlexGrid2.Refresh
     Else
       MsgBox "ûÓÐËù²éµÄ¼Ç¼", vbExclamation, "ûÓмǼ"
     End If
End If

End Sub

Private Sub Form_Load()
con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\book.mdb;"
rs.Open "select * from bookitems", con, adOpenKeyset, adLockOptimistic
End Sub
2008-11-20 09:14
yuyuer
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2008-9-26
收藏
得分:0 
已经自己解决了,是游标不对,con.cursorlocation=aduseclient
2008-11-20 13:30
快速回复:加一个什么样的条件才能执行到else处??
数据加载中...
 
   



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

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