Possible Duplicate:
SQL Server SMO complains of missing DLL
I have the following code for backing up DB's which has worked with Windows Server 2003 on SQL Server 2005:
ServerConnection ServerConn = new ServerConnection();
try
{
ServerConn.ServerInstance = "(local)";
ServerConn.LoginSecure = true;
ServerConn.Connect();
if (ServerConn.SqlConnectionObject.State == ConnectionState.Open)
{
Server svr = new Server(ServerConn);
string[] DatabaseNames = GetDatabaseNames();
foreach (string Database in DatabaseNames)
{
Backup bkp = new Backup();
bkp.Devices.AddDevice(SanityConstants.DBBackupFolder + Database + ".bak", DeviceType.File);
bkp.Database = Database;
bkp.Action = BackupActionType.Database;
bkp.Initialize = true;
bkp.SqlBackup(svr);
}
}
}
When this code is executed on a Windows Server 2008 32-bit machine, I get the following error:
"Backup failed for Server '[DT-COMP]'. -- Could not load file or assembly 'Microsoft.SqlServer.SqlEnum, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified."
SQL Server 2008 R2 is installed on this machine. I am able to replicate the issue on other Win Server 2008 machines.
Any ideas?