这是SQL建立数据集的常用方法。
  Dim Cnn As ADODB.Connection
  Dim Rst As ADODB.Recordset
  Set Rst = New ADODB.Recordset
  Set Cnn = New ADODB.Connection
  Cnn.Open "provider=microsoft.jet.oledb.4.0;extended properties='excel 8.0;imex=1';data source=" & ThisWorkbook.FullName
  Rst.Open Sql, Cnn, adOpenStatic
-------------以下是ADO建立的
  Dim rst As ADODB.Recordset 
  Set rst = New ADODB.Recordset 
      With rst 
      .Fields.Append RstFiledsName(0), adDouble ', 20, adFldIsNullable 
    End With 
  '建立数据集表头
  Set CreatSelectionHeading = rst 
  With rst 
    .Open 
    For jj = 0 To UBound(mArray) 
      .AddNew 
      .Fields(0) = mArray(jj)(0) 
      .Fields(1) = mArray(jj)(1) 
      .Fields(2) = mArray(jj)(2) 
    Next jj 
    '排序 
    .Sort = ("x Asc ,y Asc") 
  End With用SQL建立的RST每次都是新的数据集,每次查询是关闭rst,然后通过Rst.Open Sql, Cnn, adOpenStatic打开建立新的RST
请问各位大侠的问题是
而ADO rst 则要每次建立数据集表头,向数据集添加记录.用set Rst = Nothing要效率比较低.