Private Sub Command3_Click()
 Dim SQL As String
  
  Dim CN4 As New ADODB.Connection
  Dim RS4 As New ADODB.Recordset
  
  Set CN4 = New ADODB.Connection
  Set RS4 = New ADODB.Recordset
  CN4.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data\Student.mdb "
  CN4.Open
  Set RS4.ActiveConnection = CN4
  RS4.CursorLocation = adUseClient
  RS4.CursorType = adOpenForwardOnly
  
  SQL = "Select * from idea where result='已处理'"
  RS4.Open SQL
  Adodc1.RecordSource = SQL
  Adodc1.Refresh
  If RS4.EOF And RS4.BOF Then
     MsgBox "没有您要查的记录!"
  End If
  
  RS4.Close
  Set RS4 = NothingEnd Sub
Adodc1.Refresh-----------------------系统提示这条语句错了,“对象refresh的IADODC失败”?????????????
还有select语句错了?????????????

解决方案 »

  1.   

    SQL = "Select * from idea where result='" & 已处理 &"'"
      

  2.   

    SQL = "Select * from idea where result='已处理'"
      RS4.Open SQL
      
     '加上这句试试 
    adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\data\Student.mdb "Adodc1.RecordSource = SQL
      

  3.   

    Adodc1.ConnectionString = CN4.ConnectionString
      

  4.   

    没有指定ADODC的记录源命令类型
      

  5.   

    SQL = "Select * from idea where result='已处理'"
    RS4.Open SQL ,adopenkeyset,adlockreadonly
    If rs4.recordcount=0 Then
         MsgBox "没有您要查的记录!"
      End If
      
      RS4.Close
      Set RS4 = Nothing
      

  6.   

    没弄明白!从这段代码看,你既然用了RS又用ADODC1干什么啊?用RS读取一次又用ADODC1读取一次,有实际意义吗?完全可以不用RS啊