以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  备份到本地后关闭电脑  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=178795)

--  作者:cd_tdh
--  发布时间: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


--  作者:有点蓝
--  发布时间:2022/7/21 9:53:00
--  
https://www.baidu.com/baidu?ie=UTF-8&word=vb.net%20%E5%85%B3%E9%97%AD%E7%94%B5%E8%84%91