先set datagrid1.datasource=nothing
再Set Datagrid1.DataSource = rsContact试试

解决方案 »

  1.   

    给你一个我的例子吧Public Sub DataGrid1Show()Set rsdetail = New Recordset
    Dim str As String
    Dim Userid As Long
    Userid = Combo2.ItemData(Combo2.ListIndex)
    Dim StartDate As Date
    Dim EndDate As Date
    Dim StartTime As Date
    Dim EndTime As Date
    StartDate = DateValue(DTPicker1.Value)
    EndDate = DateValue(DTPicker2.Value)
    StartTime = StartDate + "00:00:00"
    EndTime = EndDate + "23:59:59"
    If StartDate > EndDate Then
    MsgBox "请检查您输入的日期!", , "Warning"
    Exit Sub
    End If
    str = "select * from user_speday where startspecday># " & StartTime & " # and endspecday<# " & EndTime & " # and userid= " & Userid & " and (dateid=999 or dateid=1000) order by startspecday"
    rsdetail.Open str, cnnView
    Set DataGrid1.DataSource = Nothing
    Set Adodc1.Recordset = rsdetail
    Set DataGrid1.DataSource = Adodc1
    Adodc1.Refresh
    DataGrid1.Refresh
    SetHead
    End Sub
      

  2.   

    喝!
    这个帖子真是无处不在??!!!(惊叹!)
    花了大血本了http://expert.csdn.net/Expert/topic/1113/1113826.xml?temp=.307583
    已经给出回复了
    试一试
      

  3.   

    把Set rsContact = conn.Execute(sContactQuery)改成以下的代碼試試:
       rscontact.open   scontactquery,conn,adOpenStatic ,adLockBatchOptimistic 
       set rscontact.activeconnection=nothing
       
     問題就可以解決了.
      

  4.   

    好象应该要set louhao = DataCombo1.text
      

  5.   

    你将label6的内容分析出来,才行
    譬如 lable6.caption="张三,李四"
    这时你写SQL为 select * from 表 where 姓名= "张三"  or "李四"
    你看作办吧???只能这样给你参考!!!