Ejemplo n.º 1
0
    // Finally the method for doing the DB stuff
    public ReturnType DoDatabaseStuff()
    {
        SqlConnection myCon = DBcon.getInstance().conn();

        try
        {
            myCon.Open();
            // ... do some DB stuff
        }
        catch (Exception ex)
        {
            // ... Some logging
        }
        finally
        {
            if (myCon.State == ConnectionState.Open)
            {
                myCon.Close();
            }

            // ... any additional cleanup in here
        }

        return     // ... some value;
    }