您的位置:程序门 -> vb -> 数据库(包含打印,安装,报表)



用vb解决access数据库备份问题


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


用vb解决access数据库备份问题
发表于:2007-05-24 18:35:29 楼主
怎么用代码实现vb解决access数据库的备份啊
      用driver   和dir   控件   再加一个button按钮实现整个数据库的备份
        备份目录在driver和dir所指定的目录下面
   
发表于:2007-05-24 21:27:281楼 得分:0
bu   zhi   dao   le
发表于:2007-05-24 21:48:452楼 得分:0
private   sub   command1_click()                         '确认数据备份
dim   s   as   string
    s   =   msgbox( "准备好了吗? ",   vbyesno   +   vbquestion,   "提示 ")
    if   s   =   vbno   then
          exit   sub
    end   if
    on   error   goto   errprompt
    me.mousepointer   =   11
    if   dir(text1.text   &   ":\数据备份 ",   vbdirectory)   =   " "   then
    mkdir   text1.text   &   ":\数据备份 "
    set   bf   =   createobject( "scripting.filesystemobject ")
    bf.copyfile   app.path   &   "\system.dll ",   text1.text   &   ":\数据备份\system "   &   date   &   ".dll "
    me.mousepointer   =   0
    s   =   msgbox( "数据已备份完毕! ",   vbinformation,   "提示 ")
errprompt:
    me.mousepointer   =   0
    select   case   err.number
        case   57
            s   =   msgbox( "磁盘已满! ",   vbcritical,   "提示 ")
        case   70
            s   =   msgbox( "磁盘写保护!请回到原文件进行复制system.dll ",   vbcritical,   "提示 ")
    end   select
    else
    on   error   goto   errprompt1
    set   bf   =   createobject( "scripting.filesystemobject ")
    bf.copyfile   app.path   &   "\system.dll ",   text1.text   &   ":\数据备份\system "   &   date   &   ".dll "
    me.mousepointer   =   0
    s   =   msgbox( "数据已备份完毕! ",   vbinformation,   "提示 ")
errprompt1:
    me.mousepointer   =   0
    select   case   err.number
        case   57
            s   =   msgbox( "磁盘已满! ",   vbcritical,   "提示 ")
        case   70
            s   =   msgbox( "磁盘写保护!请回到原文件进行复制system.dll ",   vbcritical,   "提示 ")
    end   select
    end   if
end   sub


快速检索

最新资讯
热门点击