Ejemplo n.º 1
0
 public virtual void CloseDb(SqlDb db)
 {
     if (!db.IsClosed)
     {
         if (!db.IsAdapter && db.Connection != null)
         {
             SqlConnection cn = (SqlConnection)db.Connection;
             if (cn.State != ConnectionState.Closed)
             {
                 cn.Close();
             }
             cn.Dispose();
             db.Connection = null;
         }
     }
 }
Ejemplo n.º 2
0
 public virtual void OpenDb(SqlDb db)
 {
     if (db.IsClosed)
     {
         if (db.Connection == null)
         {
             db.Connection = new SqlConnection(connString);
             db.Connection.Open();
         }
         else
         {
             if (db.Connection.State == ConnectionState.Closed)
             {
                 db.Connection.Open();
             }
         }
     }
 }