0

Dear All ,

I need to backup the sql server 2005 express database . It works fine if I make backup to specific folder"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup" . But if I change the path to any other path . I got an error "Backup failed for Server 'server name'. "

my code is

Dim sqlBackup As New Backup()
sqlBackup.Action = BackupActionType.Database
sqlBackup.BackupSetDescription = "ArchiveDataBase:" + DateTime.Now.ToShortDateString()
sqlBackup.BackupSetName = "Archive"
sqlBackup.Database = "data"
Dim deviceItem As New BackupDeviceItem("C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Backup\rft.bak", DeviceType.File)
Dim connection As New ServerConnection(".\SQLEXPRESS")
Dim sqlServer As New Server(connection)
Dim db As Database = sqlServer.Databases("RegServer")
sqlBackup.Initialize = True
sqlBackup.Checksum = True
sqlBackup.ContinueAfterError = True
sqlBackup.Devices.Add(deviceItem)
sqlBackup.Incremental = False
sqlBackup.ExpirationDate = DateTime.Now.AddDays(3)
sqlBackup.LogTruncation = BackupTruncateLogType.Truncate
sqlBackup.FormatMedia = False
sqlBackup.SqlBackup(sqlServer)

Thank you all in advance for your support

2
Contributors
1
Reply
8
Views
7 Years
Discussion Span
Last Post by S.R.SENTHUJAN
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.