Exemplo n.º 1
0
        /// <summary>
        /// 释放一个活运链接

        /// </summary>
        /// <param name="AConnect"></param>
        public static void ReturnConnect(JDBBASE AConnect)
        {
            try
            {
                if (AConnect != null)
                {
                    ActiveCount--;
                    if (ActiveCount > iDB_MAX)
                    {
                        AConnect.CloseConnect();
                    }
                    else
                    {
                        if (AConnect.Connectd)
                        {
                            Connects.Enqueue(AConnect);
                        }
                        else
                        {
                            AConnect = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log4net.WriteLogFile("数据库连接归还失败:" + ex.Message, 3);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 销毁链接池
 /// </summary>
 public static void ClearPool()
 {
     while (Connects.Count > 0)
     {
         JDBBASE row = (JDBBASE)Connects.Dequeue();
         row.CloseConnect();
     }
     ActiveCount = 0;
 }