set DATAGIRD.datasource=adoRec 
set msflexgrid.datasource=adoRec 

解决方案 »

  1.   

    已经照您的给出的方式写过,但还是会报错 “什么行集合什么的“只有在mshflex下用
    set mshflex.recordset=adoRec 才正常,请问这是什么原因?
      

  2.   

    Dim adoCnn As New adodb.Connection
     Dim adoCmm As New adodb.Command
     Dim adoRec As New adodb.Recordset
     
     adoCnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB;Persist Security Info=False"
     
     adoCmm.ActiveConnection = adoCnn
     adoCmm.CommandType = adCmdText
     adoCmm.CommandText = "select * from Customers"
     Set adoRec = adoCmm.Execute
     Set MSHFlexGrid1.DataSource = adoRec