public void CloseCon() { try { if (asO != null && asO.IsAlive) { asO.AbortOperation(); } asO = null; } catch { } try { StopTimer(); } catch { } try { DoBeforeClose(); } catch { } try { if (cn != null && cn.State != ConnectionState.Closed) { cn.Close(); } } catch { } cn = null; GC.Collect(); }
protected void OpenConnection(string connectionString) { CloseCon(); this.curConStr = connectionString; asO = new AsyncConnectionOpener(connectionString); asO.DoOpen(ConnectionOpened); }