Hi,
I'm trying to programmaticall y backup a database (SQL 2005). I get a
"Device not found" error when I specify a full user given path in the
backup, but when I just specify a filename it works, putting the backup into
the SQL folder: C:\Program Files\Microsoft SQL Server\MSSQL.1\ MSSQL\Backup.
What I want to do is have the backup written to the local user data folder.
My code looks like this (VB.NET):
theServer = New Server(m_Source .Server)
m_Backup = New Backup
m_Backup.Action = BackupActionTyp e.Database
m_Backup.Backup SetDescription = "Backup of zzz"
m_Backup.Backup SetName = "zzz Backup"
m_Backup.Databa se = m_Source.Catalo g
tempPath = Application.Loc alUserAppDataPa th + "\backup_zzz.ba t"
theDeviceItem = New BackupDeviceIte m(tempPath, DeviceType.File )
m_Backup.Device s.Add(theDevice Item)
m_Backup.Checks um = True
m_Backup.Contin ueAfterError = True
m_Backup.Increm ental = False
m_Backup.Expira tionDate = New Date(2006, 10, 5)
m_Backup.LogTru ncation = BackupTruncateL ogType.Truncate
m_Backup.MediaD escription = "file backup"
m_Backup.Initia lize = True
m_Backup.Percen tCompleteNotifi cation = 10
m_Backup.Restar t = True
m_Backup.Retain Days = 5
m_Backup.SqlBac kup(theServer)
Any thoughts?
Thanks
Robin
I'm trying to programmaticall y backup a database (SQL 2005). I get a
"Device not found" error when I specify a full user given path in the
backup, but when I just specify a filename it works, putting the backup into
the SQL folder: C:\Program Files\Microsoft SQL Server\MSSQL.1\ MSSQL\Backup.
What I want to do is have the backup written to the local user data folder.
My code looks like this (VB.NET):
theServer = New Server(m_Source .Server)
m_Backup = New Backup
m_Backup.Action = BackupActionTyp e.Database
m_Backup.Backup SetDescription = "Backup of zzz"
m_Backup.Backup SetName = "zzz Backup"
m_Backup.Databa se = m_Source.Catalo g
tempPath = Application.Loc alUserAppDataPa th + "\backup_zzz.ba t"
theDeviceItem = New BackupDeviceIte m(tempPath, DeviceType.File )
m_Backup.Device s.Add(theDevice Item)
m_Backup.Checks um = True
m_Backup.Contin ueAfterError = True
m_Backup.Increm ental = False
m_Backup.Expira tionDate = New Date(2006, 10, 5)
m_Backup.LogTru ncation = BackupTruncateL ogType.Truncate
m_Backup.MediaD escription = "file backup"
m_Backup.Initia lize = True
m_Backup.Percen tCompleteNotifi cation = 10
m_Backup.Restar t = True
m_Backup.Retain Days = 5
m_Backup.SqlBac kup(theServer)
Any thoughts?
Thanks
Robin
Comment