Procedure txggl_sjrz_exefrm.filesaveasmnuclick (Sender: tobject );
VaR
I: integer;
STR: string;
Strlist: tstringlist;
Issave: Boolean;
Title: string;
Begin
Try
If savedialog1.execute then
Begin
Issave: = true;
If fileexists (savedialog1.filename) then
If IDNO = MessageBox (handle, 'the file already exists. Are you sure you want to save it? ',' Hint ', mb_iconstop + mb_yesno) then
Begin
Issave: = false;
End;
If issave then
Begin
Strlist: = tstringlist. Create;
With rsrzdbgrid do
Begin
Title: = '';
For I: = 0 to columns. Count-1 do
Begin
Title: = title + columns [I]. Title. Caption + #9;
End;
Strlist. Add (title );
End;
With dm1.adoquery1 do
Begin
First;
While not EOF do
Begin
STR: = '';
For I: = 0 to FieldCount-1 do
STR: = STR + fields [I]. asstring + #9;
Strlist. Add (STR );
Next;
End;
Strlist. savetofile (savedialog1.filename );
MessageBox (handle, 'Data is successfully saved. ', 'hs', mb_ OK + mb_iconinformation );
End;
End;
End;
Finally
Freeandnil (strlist );
End;
End;