dim sqlrec as new adodb.recordset
sqlrec.open "select * from slfc where nua='3'",你的连接
set dbgrid.datasoure=sqlrec
....
大概就是这样子.你试试.

解决方案 »

  1.   

    With Me.dcData1
            .DatabaseName = "c:\temp.mdb"
            .RecordSource = ="select * from slfc where nua='3'"
            .Refresh
        End With
      

  2.   

    写错了,我写的是ADODC控件。
      

  3.   

    dim ac_tmp    as new adodb.connection
    dim ar_tmp    as new adodb.recordset
    with ac_tmp
    ...
    ...
    end withtxtSQL = "select * from slfc where nua='"& combobox.text &"'"
    with ar_tmp
        if .state=adstateopen then .close
        .open txtSQL,ac_tmp,adopenkeyset,adlockreadonly
    end withif ar_tmp.recordcount>0 then
        text.text=ar_tmp!名称 
    else
        text.text=""
    endif
    ar_tmp.close
      

  4.   

    用ADO.REcordset返回到控件的数据源