/// <summary> /// 新建连接池并加入池中池 /// </summary> /// <param name="connectionstring"></param> /// <returns></returns> public static DataConnectionPool AddDcList(string connectionstring) { try { DataConnectionPool dc = new DataConnectionPool(connectionstring); DcList.Add(dc); return(dc); } catch (Exception e) { return(null); } }
public static DataConnectionPool GetDc(string connectionstring) { try { DataConnectionPool dc = GetDcp(connectionstring.Replace('|', '\\')); if (dc.connection.State != System.Data.ConnectionState.Open) { dc.connection.Open(); } return(dc); } catch (Exception e) { DcList.Clear();//链接池不知何故会挂掉,在这里加一个判断,如果挂了就清空连接池重新来过。 return(null); } }