var str : TStringList; s : string; i : integer; begin if SaveDialog1.Execute then begin str:=TStringList.Create(); try s:=''; for i:=0 to ADOQuery1.FieldCount-1 do begin s:=s+ADOQuery1.Fields[i].FieldName+#9; Application.ProcessMessages; //showmessage(s); end; str.Add(s); ADOQuery1.First; while not ADOQuery1.Eof do begin s:=''; for i:=0 to ADOQuery1.FieldCount-1 do begin s:=s+ADOQuery1.Fields[i].AsString+#9; Application.ProcessMessages; //showmessage(s); end; str.Add(s); ADOQuery1.Next; end; str.SaveToFile(SaveDialog1.FileName); MessageBox(Application.Handle,'数据导出完毕!','系统提示',MB_ICONINFORMATION or MB_OK); except MessageBox(Application.Handle,'数据不能正常导出,请重试!','系统提示',MB_ICONINFORMATION or MB_OK); str.Free; end; end;
str : TStringList;
s : string;
i : integer;
begin
if SaveDialog1.Execute then begin
str:=TStringList.Create();
try
s:='';
for i:=0 to ADOQuery1.FieldCount-1 do begin
s:=s+ADOQuery1.Fields[i].FieldName+#9;
Application.ProcessMessages;
//showmessage(s);
end;
str.Add(s);
ADOQuery1.First;
while not ADOQuery1.Eof do begin
s:='';
for i:=0 to ADOQuery1.FieldCount-1 do begin
s:=s+ADOQuery1.Fields[i].AsString+#9;
Application.ProcessMessages;
//showmessage(s);
end;
str.Add(s);
ADOQuery1.Next;
end;
str.SaveToFile(SaveDialog1.FileName);
MessageBox(Application.Handle,'数据导出完毕!','系统提示',MB_ICONINFORMATION or MB_OK);
except
MessageBox(Application.Handle,'数据不能正常导出,请重试!','系统提示',MB_ICONINFORMATION or MB_OK);
str.Free;
end;
end;