Why no need to open and close connection in enterprise library? RRS feed

  • Question

  • there is no need to open and close connection, does the connection maintain open when using Database db = DatabaseFactory.CreateDatabase();

    if redirect from web page 1 to web page 2, does this db connection closed? when will it close connection? How to dispose it?

    is it a must to use endexecutereader?

    Database db = DatabaseFactory.CreateDatabase();
      using (IDataReader datareader = db.ExecuteReader(CommandType.Text, queryString))
       while (datareader.Read())
        old_Password = datareader["Password"].ToString();


    Wednesday, June 22, 2011 9:20 AM