dim rs as new adodb.recordset
rs.open "select * from test",con, adOpenKeyset, adLockOptimistic
set datagrit.datasource=rs

解决方案 »

  1.   

    http://www.wzjcw.net/vbgood/taishan/index.html有几个代码可以参考
      

  2.   

    Dim cn As New Connection
       Dim rs As New Recordset
       Private Sub Command1_Click()   cn.CursorLocation = adUseClient
       cn.Open "...."
       rs.Open "....", cn, ....
       Text1.Text = rs("ActivityName")
       Set DataGrid1.DataSource = rsEnd Sub
      

  3.   

    http://www.wzjcw.net/vbgood/taishan/迷你数据浏览器.zip
      

  4.   

    With Rs
           If .State = adStateOpen Then
              .Close
           End If
           .ActiveConnection = adoCN
           .CursorLocation = adUseClient
           .CursorType = adOpenDynamic
           .LockType = adLockBatchOptimistic
           .Source = "SELECT * FROM Dm_Spdm where deptcode='" & cDeptCode & "' ORDER BY spdm"
           .Open
        End With
    Set  DataGrid1.DataSource  =  rs
      
      
      

  5.   

    是不是我的问题太菜啦,没办法,我也恨自己为什么这么菜。
    曾经有一道菜,摆在我的面前,我不想吃,因为我TMD的太菜了。
      

  6.   

    我网站上有一个专题讲VB中用ADO
    http://sanjianxia.myrice.com
      

  7.   

    Dim  adoCn  As  New  Connection
    Dim  Rs  As  New  Recordset
    With  Rs
                    If  .State  =  adStateOpen  Then
                          .Close
                    End  If
                    .ActiveConnection  =  adoCN
                    .CursorLocation  =  adUseClient
                    .CursorType  =  adOpenDynamic
                    .LockType  =  adLockBatchOptimistic
                    .Source  =  "SELECT  *  FROM  Dm_Spdm  where  deptcode='"  &    cDeptCode  &    "'  ORDER  BY  spdm"
                    .Open
              End  With
      Set    DataGrid1.DataSource    =    rs
      

  8.   

    假设我用ado打开一个表tblProvince  包含ProvinceID,ProvinceName我想显示在datagrid中。应该怎么写?
      

  9.   

    conn.open "DSN……………………"rs.open "Select * From Employee", conn, 1, 1Set Datagrid1.DataSource = rs