Foxtable(狐表)用户栏目专家坐堂 → 备份到本地后关闭电脑


  共有5053人关注过本帖树形打印复制链接

主题:备份到本地后关闭电脑

帅哥哟,离线,有人找我吗?
cd_tdh
  1楼 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐精 帖子:3051 积分:20414 威望:0 精华:0 注册:2016/3/28 16:57:00
备份到本地后关闭电脑  发帖心情 Post By:2022/7/21 9:27:00 [只看该作者]

老师,做了一个数据库备份,然后下载到本地电脑,下载完成后关闭本地电脑应该怎么写呢?

Dim cn As Connection = Connections("外部数据")
Dim lx As Integer = cn.SourceType
If lx = 2 Then
    Dim str As String = cn.ConnectionString
    Dim mc As String
    '获取外部数据源名称
    For Each s As String In str.split(";")
        If s.StartsWith("Initial Catalog") Then
            mc = s.split("=")(1)
        End If
    Next
    '备份数据库到服务器E:\FTP\备份
    Dim bc As String = format(Date.now,"yyyyMMddHHmmss") & ".bak"
    Dim bf As String = "E:\FTP\备份\" & bc
    Dim cmd As New SQLCommand
    cmd.C ommandText = "use master;BACKUP DATABASE " & mc & "  TO DISK = '" & bf & "'  With FORMAT,CHECKSUM;"
    cmd.C
    cmd.ExecuteNonQuery()
    '下载备份到本地电脑
    Dim ftp1 As new ftpclient
    ftp1.host=

    ftp1.Account = 
    ftp1.password = 
    If ftp1.Download("\备份\" & bc,"G:\0软件开发\数据备份\" & bc,True) = True Then
        Messagebox.show("备份到本地成功!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    Else
        Messagebox.show("备份到本地失败!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    End If
End  If


 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106112 积分:539671 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/7/21 9:53:00 [只看该作者]


 回到顶部