Check if the connection is still open...

Discussion in 'C#' started by Krstevski, Sep 3, 2010.

  1. Krstevski

    Krstevski New Member

    Joined:
    Sep 3, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hello friends, I have a small problem, I need to check if the database connection is still open. Here is my code...

    try {
    // new connection
    // connection open
    // other code
    // close the connection
    } catch (Exception ex) {
    // handling exception
    } finally {
    // Here I want to close the connection if still open
    }
    So... how to check id the connection is still open ?
    p.s. I use C#.NET 2.0, MS Access database (OleDbConnection).

    Thanks.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice