Hi folks,
I am trying to utilize the sqldmo object to restore a sql database
programmatically in VB. I have included the Reference for Microsoft SQLDMO
Object Library but my code fails on the following:
oRestore.Action = SQLDMORestore_Database
I get the following error:
"Compile Error: Can't find object or library"
Is there another library I need to include in my code?
Here is my code copied straight from MSDN:
Dim oRestore As New SQLDMO.Restore
oRestore.Action = SQLDMORestore_Database
oRestore.Database = "Content"
'oRestore.Action = SQLDMORestore_Database
' Example illustrates restore from a striped backup. Two source devices
' are specified. The full database backup is indicated as the first
' backup set by using the FileNumber property. Note: Device creation is
' not illustrated in this example.
oRestore.disks = strServerpath & "/mssql7/backup.bak"
'oRestore.Devices = "[NorthDev1],[NorthDev2]"
oRestore.FileNumber = 1
' Optional. ReplaceDatabase property ensures that any existing copy
' of the database is overwritten.
oRestore.ReplaceDatabase = True
' Call SQLRestore method to perform the restore. In a production
' environment, consider wrapping the method call with a wait pointer
' or use Restore object events to provide feedback to the user.
'
' Note: Create and connect of SQLServer object used is not
' illustrated in this example.
oRestore.SQLRestore oSQLServer
Thank you and much obliged,
Greg
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.298 / Virus Database: 161 - Release Date: 11/13/2001