'备份数据库
'BackupDataName数据库存放的绝对路径
Function BackUpData(ByVal BackupDataName As String) As String
Dim Conn As New SqlClient.SqlConnection(ModConn.GetConn)
Dim mySelectQuery As String = "Backup database popcrm to DISK ='" & BackupDataName & "'"
Dim myReader As SqlClient.SqlDataReader
Dim Cmd As New SqlCommand(mySelectQuery, Conn)
If Conn.State = ConnectionState.Closed Then Conn.Open()
Try
Cmd.ExecuteNonQuery()
BackUpData = ""
Catch ExSQL As SqlException
If ExSQL.Number = 3201 Then
BackUpData = "请正确输入备份文件的存放路径!"
Else
BackUpData = ExSQL.Message
End If
Catch Ex As Exception
BackUpData = Ex.Message
End Try
Cmd.Connection.Close()
Cmd.Dispose()
Conn.Dispose()
End Function