1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Check if the connection is still open...

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

  1. Krstevski

    Krstevski New Member

    Sep 3, 2010
    Likes Received:
    Trophy Points:
    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).


Share This Page