要读的表格中明明没有空,奇怪的是有个字段竟然读出了空,还是有的行不为空,有的行为空,不知道怎么回事 MyQuery:=TADOQuery.Create(nil); MyQuery.Connection:=Form54.con1; try with MyQuery do begin Close; SQL.Clear; SQL.Text:='select * from [' + Form54.cbb1.Items[Form54.cbb1.ItemIndex].Caption + ']'; Open; advstrngrd1.RowCount:=RecordCount+2; N:=1; while not Eof do begin advstrngrd1.Cells[0,N]:=N.ToString; for I := 1 to advstrngrd1.ColCount-1 do begin 字段名:=advstrngrd1.Cells[I,0]; for J := 1 to Form54.advstrngrd1.RowCount-1 do begin if Form54.advstrngrd1.Cells[1,J] = 字段名 then begin 字段名:=Form54.advstrngrd1.Cells[2,J]; end; end; 值:=FieldByName(字段名).AsString; advstrngrd1.Cells[I,N]:=值; end; N:=N+1; Next; end; end; finally MyQuery.Free; end; 附件是excel文件。