UnitDbBuckup.pas
资源名称:东之源.rar [点击查看]
上传用户:zexin0769
上传日期:2010-01-19
资源大小:443k
文件大小:2k
源码类别:
百货/超市行业
开发平台:
Delphi
- unit UnitDbBuckup;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, ComCtrls, Gauges, ExtCtrls, StdCtrls;
- type
- TFrameDbBuckup = class(TFrame)
- Image1: TImage;
- GroupBox1: TGroupBox;
- Image2: TImage;
- Image3: TImage;
- SaveDialog1: TSaveDialog;
- Gauge1: TGauge;
- OpenDialog1: TOpenDialog;
- procedure Image2Click(Sender: TObject);
- procedure Image3Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- implementation
- uses UnitLogin;
- {$R *.dfm}
- procedure TFrameDbBuckup.Image2Click(Sender: TObject);
- var
- i: integer;
- begin
- try
- if not savedialog1.Execute then exit;
- if FileExists(savedialog1.FileName+'.mdb') then
- begin
- if Messagebox(handle,'存在数据库重名,是否覆盖?','存盘选项',mb_iconquestion+mb_yesno)=IDNo then Exit;
- end
- else
- begin
- for i:=Gauge1.MinValue to Gauge1.MaxValue do
- Gauge1.Progress := i;
- CopyFile(PChar(DataFile),PChar(SaveDialog1.FileName+'.mdb'),True);
- Messagebox(handle,'数据库备份成功!','备份数据',mb_iconinformation+mb_ok);
- end;
- except
- Messagebox(handle,'警告:数据库备份失败!','存盘错误',mb_iconwarning+mb_ok);
- end;
- end;
- procedure TFrameDbBuckup.Image3Click(Sender: TObject);
- var
- i: integer;
- begin
- try
- if not opendialog1.Execute then exit;
- if Messagebox(handle,'警告:现有数据有可能丢失,确定还原?','确定还原',mb_iconquestion+mb_yesno)=IDNo then Exit;
- for i:=Gauge1.MinValue to Gauge1.MaxValue do
- Gauge1.Progress := i;
- // CopyFile(PChar(OpenDialog1.FileName+'.mdb'),PChar(Form1.DataFile),True);
- Messagebox(handle,'数据库还原成功!','还原数据',mb_iconinformation+mb_ok);
- except
- Messagebox(handle,'警告:数据库还原失败!','读取错误',mb_iconwarning+mb_ok);
- end;
- end;
- end.