public static string testStatus = ""; //实时数据库DAO层专用,用于多实时数据库实现 #endregion //实时数据库连接测试 public static bool connectTest() { ErrorFlag = false; ErrorInfo = ""; try { rtdbConnStr = (APPConfig.rtdb_connString); if (APPConfig.rtdb_Type == "PI") //PI数据库的情况下,使用长连接类 { DBInterface.RTDBInterface.LongPI.RTDbHelper rtdbhelperpi = new DBInterface.RTDBInterface.LongPI.RTDbHelper(); //如果出现“类型初始值设定项引发异常”的错误,请检查RTDbType、RTDbConnection两个静态参数的设置是否正确。尤其是改为xml配置时,如果配置不正确,则或报出该错误。 testStatus = rtdbhelperpi.ConnTest(); } else if (APPConfig.rtdb_Type == "PGIM") //PGIM数据库的情况下,使用长连接类 { DBInterface.RTDBInterface.LongPGIM.RTDbHelper rtdbhelperpgim = new DBInterface.RTDBInterface.LongPGIM.RTDbHelper(); testStatus = rtdbhelperpgim.ConnTest(); } else if (APPConfig.rtdb_Type == "XIANDB") //XIANDB数据库的情况下,使用长连接类 { DBInterface.RTDBInterface.LongXIANDB.RTDbHelper rtdbhelperxiandb = new DBInterface.RTDBInterface.LongXIANDB.RTDbHelper(); testStatus = rtdbhelperxiandb.ConnTest(); } else if (APPConfig.rtdb_Type == "TOM") //XIANDB数据库的情况下,使用长连接类 { DBInterface.RTDBInterface.LongTOM.RTDbHelper rtdbhelpertom = new DBInterface.RTDBInterface.LongTOM.RTDbHelper(); testStatus = rtdbhelpertom.ConnTest(); } else { DBInterface.RTDBInterface.RTDbHelper rtdbhelper = new DBInterface.RTDBInterface.RTDbHelper(); testStatus = rtdbhelper.ConnTest(); } return(true); } catch (Exception ex) { ErrorInfo = ex.ToString(); string messageStr; messageStr = String.Format("DAO层connectTest()错误:---------->") + Environment.NewLine; //logHelper.Error(messageStr); messageStr += String.Format("详细错误信息:" + ex.ToString()); logHelper.Error(messageStr); return(false); } }