procedure SaveVarToFile(SqlStr, FileName: String);
var AStr:TStringList;
AFilePath:string;
begin
if FileName='' then
FileName:=FormatDateTime('YYYYMMDDHHMMSS',Now);
AStr:=TStringList.Create();
AStr.Add(SqlStr);
AFilePath:='';
AFilePath:=GetCurrentDir;
AFilePath:=AFilePath+'\'+FileName+'.txt';
AStr.SaveToFile(AFilePath);
AStr.Free;
end;
var AStr:TStringList;
AFilePath:string;
begin
if FileName='' then
FileName:=FormatDateTime('YYYYMMDDHHMMSS',Now);
AStr:=TStringList.Create();
AStr.Add(SqlStr);
AFilePath:='';
AFilePath:=GetCurrentDir;
AFilePath:=AFilePath+'\'+FileName+'.txt';
AStr.SaveToFile(AFilePath);
AStr.Free;
end;