我把代码发上来,大家帮我看看
if OpenDialog1.Execute then
begin
sql:='select * from [Text;FMT=Delimited;HDR=Yes;DATABASE="'+ExtractFilePath(OpenDialog1.FileName)+'";].['+StringReplace(ExtractFileName(OpenDialog1.FileName),ExtractFileExt(OpenDialog1.FileName),'',[rfReplaceAll])+'#csv]';
Query1.SQL.Add(sql);
Query1.Open ;
if Query1.RecordCount>0 then
ShowMessage('OK');
end;