用ADOConnection ADOTable 链接Excel。分别用了DBGrid和StringGrid。
在DBGrid中的记录数是正确的,用StringGrid却总是少最后一条记录. //导入数据到StringGrid
 colcount := fromADOTable.Fields.Count;//得到数据集中的字段数与记录数
 rowcount := fromADOTable.RecordCount; fromProgressBar.Max := rowcount;//进度条的初始化
 fromProgressBar.Position := 0; fromStringGrid.ColCount := colcount+1; //调整StringGrid行、列数。列数增加一行,以便确定是否导入
 fromStringGrid.RowCount := rowcount; fromStringGrid.Cells[0,0] := '序';
 fromStringGrid.Cells[1,0] := '是否导入'; Lbcolandrow.Caption := '数据源中共有'+InttoStr(colcount)+'个字段和'+ InttoStr(rowcount)+'条记录!'; for row := 0 to rowcount-1 do
  begin
    fromStringGrid.Cells[1,row+1] := '是'; //用户确定是否导入
    fromStringGrid.Cells[0,row+1] := InttoStr(row+1); //每条记录作标记,既第一列排序
    for col := 0 to colcount-1 do
      begin
        if fromADOTable.Fields[col].Value <> null then//如果记录不会空,则赋值
          begin
            fromStringGrid.Cells[col+2,row+1] := fromADOTable.Fields[col].Value;
           end;
      end;    if not fromADOTable.Eof then //如果不是最后一条记录,则指针下移
     begin
        fromADOTable.Next;
        fromProgressBar.Position := row;
     end;
  end;
  ShowMessage('共执行了:'+InttoStr(number));