/// <summary> /// 构造函数 /// </summary> public DataBaseSync() { try { dbm = new DataBaseManage(); dbm.SyncComplete += new DataBaseManage.SyncCompleteEventHandler(dbm_SyncComplete); dbm.GuageEvent += new DataBaseManage.GuageEventHandler(dbm_GuageEvent); dbm.ErrorMessage += new DataBaseManage.ErrorMessageEventHandler(dbm_ErrorMessage); } catch (Exception errInfo) { // 缺少sqldmo.dll文件 if (errInfo.Message.IndexOf("10020100-E260-11CF-AE68-00AA004A34D5") > 0 || errInfo.Message.IndexOf("10020200-E260-11CF-AE68-00AA004A34D5") > 0) { try { // "缺少sqldmo.dll" 修复 //File.Copy(Application.StartupPath + "\\filebackup\\sqldmo.dll", @"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\sqldmo.dll"); }catch (Exception ce) { ErrorMessage(2021504, ce.StackTrace, "[DataBaseSync:DataBaseSync]", "sqldmo修复失败"); //"sqldmo修复失败"; } } else if (errInfo.Message.IndexOf("0022406-E260-11CF-AE68-00AA004A34D5") > 0) { //dbm_ErrorMessage(1, "", "[ DBBackUp:DBBackUp ]", "SqlServer2000 SP4补丁未安装或未安装完整"); //"SqlServer2000 SP4补丁未安装或未安装完整"; } } }
/// <summary> /// 初始化参数 /// </summary> /// <param name="oldDbName">原数据库名</param> /// <param name="backUpName">备数据库名</param> /// <param name="backUpPath">备数据库文件路径</param> /// <param name="oldDbPath">原数据库文件路径</param> public DataBaseSync(string oldDbName, string backUpName, string backUpPath, string oldDbPath) { try { dbm = new DataBaseManage(oldDbName, backUpName, backUpPath, oldDbPath); } catch (Exception errInfo) { // 缺少sqldmo.dll文件 if (errInfo.Message.IndexOf("10020100-E260-11CF-AE68-00AA004A34D5") > 0 || errInfo.Message.IndexOf("10020200-E260-11CF-AE68-00AA004A34D5") > 0) { try { // "缺少sqldmo.dll" 修复 File.Copy(Application.StartupPath + "\\filebackup\\sqldmo.dll", @"C:\Program Files\Microsoft SQL Server\80\Tools\Binn\sqldmo.dll"); } catch (Exception) { //"sqldmo修复失败"; } } else if (errInfo.Message.IndexOf("0022406-E260-11CF-AE68-00AA004A34D5") > 0) { //"SqlServer2000 SP4补丁未安装或未安装完整"; //dbm_ErrorMessage(1, "", "[ DBBackUp:DBBackUp ]", "SqlServer2000 SP4补丁未安装或未安装完整"); } } }