set datagrid.datasource=ado.recordset

解决方案 »

  1.   


    rs.CursorLocation=adUseClient
    rs.CursorType=AdOpenDynamic
    rs.LockType=adLockOptimistic
    rs.open "select * from XXX表",cn
    set datagrid1.datasource=rs
    datagrid1.refresh
      

  2.   

    Dim  Rs    As  New  ADODB.Recordset  
           With  Rs  
                   If  .State  =  adStateOpen  Then  
                           .Close  
                   End  If  
                   .ActiveConnection  =  db  
                   .CursorLocation  =  adUseClient  
                   .CursorType  =  adOpenDynamic  
                   .LockType  =  adLockBatchOptimistic  
                   .Source  =    "SELECT  *  FROM  jin  "  
                   .Open  
           End  With  
    Set  DataGrid1.DataSource=Rs