rsstudent.Open "select * from information where " & Combo1.Text & " = '"& Text1.Text &"'", conn

解决方案 »

  1.   

    rsstudent.Open "select * from information where " & Combo1.Text & " = '" & Text1.Text & "'" , conn,3,1
      

  2.   

    将这句
    rsstudent.Open "select * from information where Combo1.Text = " + Text1.Text, conn
    改为
    rsstudent.Open "select * from information where " & Combo1.Text & " = '"& Text1.Text &"'", conn
    因为你将 Combo1.Text = 放在双引号中,那么VB将把它当做字符串处理.
      

  3.   

    哥哥们分已经给了,但小弟还有一个问题要在问就是刚才那个查询,我想吧结果给DataGrid1控件显示,用的是这样的语句 
    If rsstudent.RecordCount <> 0 Then
        Set DataGrid1.DataSource = rsstudent
      Else
      MsgBox "数据库错误", vbExclamation, "错误"
      End If
    可显示说行集合不能作标签。这是为何?