opendialog1
来源:互联网 发布:c#数组添加数据 编辑:程序博客网 时间:2024/05/19 17:25
1)指定显示指定扩展名如ACCESS的MDB
利用控件的FILTER属性:在FILTER NAME:*.mdb(ACCESS 文件) FILTER:*.mdb
程序中利用代码:
opendialog1.filter:='所有文件(*.*)|*.*';
opendialog1.filter:='文本文件(*.txt)|*.txt';
opendialog1.filter:='文本文件(*.txt)|*.txt|FLASH文件(*.swf)|*.swf';
如果显示2个以上的类型,中间用|*隔开
2)取得路径和要打开的文件名
if opendialog1.Execute then
edit1.Text:=opendialog1.FileName;
3)初始化OPENDIALOG的打开路径
var
apppath,dbpath,backuppath:string;
a:string;
begin
opendialog1.InitialDir := ExtractFileDir(paramstr(0)) + '/db/dbbackup';
//当前程序目录中的db/dbbackup/目录中
dm.dm1.adocn1.Connected:=false;
if opendialog1.Execute then
a:=opendialog1.FileName
else
exit;
AppPath := ExtractFilePath(Application.ExeName);
DBPath := AppPath + 'db/db.mdb';
BackupPath :=a;
if not DirectoryExists(AppPath+'db/dbbackup/') then
showmessage('备份目录不存在!')
else
begin
CopyFile(pchar(BackupPath), pchar(dbPath), false);
showmessage('恢复成功!');
备份:
var
apppath, dbpath, backuppath: string;
a: string;
begin
a := formatdatetime('yymmddHHMM', now); //0711242203
AppPath := ExtractFilePath(Application.ExeName);
DBPath := AppPath + 'db/db.mdb';
BackupPath := AppPath + 'db/dbbackup/backup' + a + '.mdb';
if not DirectoryExists(AppPath + 'db/dbbackup/') then
showmessage('备份目录不存在!')
else
begin
CopyFile(pchar(DBPath), pchar(BackupPath), false);
showmessage('备份数据库' + backuppath + '成功!');
- opendialog1
- Delphi OpenDialog1设置多个过滤条件
- WEB Service 暴露的XML文档中存在低序位非打印 ASCII 字符
- Inline hook ObReferenceObjectByHandle,附加问题笔记做记录
- HPUX软件仓库
- (转)struts2中iterator标签的相关使用
- 下载安装与运行JBoss
- opendialog1
- 开始写Blog了,记忆每天的想法。
- SOAOffice中间件让文档管理、知识管理系统应用走出困境
- TestDirector-非常有效的缺陷跟踪管理工具
- TestDirector-缺陷跟踪工具用户使用指南
- 将dataset转换成xml
- java ioc初学
- 设置透明对话框
- TestDirector功能介绍