怎样可以将保存的文件名取为样式....(25分)

  • 主题发起人 tswhoney
  • 开始时间
T

tswhoney

Unregistered / Unconfirmed
GUEST, unregistred user!
怎样可以将保存的文件名取为样式:地区+时间,如:昆明200210
不用手工输入,而是程序实现.
 
1、function now
2、tdatetime => string
3、组合自己想要的内容
 
能详细点吗?
 
memo1.lines.savetofile('昆明'+DateToStr(Date))
 
filename:=diqu+formatdatetime('YYYYMM',now);
就可以呀
 
我的意思是将数据库的一条记录倒到txt文件中.如何实现,望各位高手赐教.
 
procedure TForm1.Button2Click(Sender: TObject);
var
i,iCount,iPos:integer ;
txtFile :TStringList ;
sFields :array of string ;
sSfzhm ,sName,tepStr :String ;
begin
txtFile :=TStringList.Create ;
txtFile.LoadFromFile ('d:/Demo.txt');
//tepStr :=txtFile.Strings[0];
For iCount := 1 to txtFile.Count -1 do
begin
tepStr := txtFile.Strings [iCount ] ;
iPos := Pos ('|',tepStr);
sName := Copy (tepStr,1,iPos-1) ;
tepStr:= Copy (tepStr,iPos+1,Length (tepStr));
iPos := Pos ('|',tepStr);
sSfzhm := Copy (tepStr,1,iPos-1) ;
if table1.Locate ('sfzhm',sSfzhm,[]) then
begin
table1.edit ;
Table1.FieldByName('XX').AsString :=Table1.FieldByName('XX').AsString +'1';
table1.post ;
end ;
end ;
end;
 
顶部