| 1. |
How Do You Ensure That The Database Connections Are Always Closed? |
|
Answer» To ensure that the database CONNECTIONS are ALWAYS closed, open the connection inside of a using block, as SHOWN in the following code fragment. Doing so ENSURES that the connection is automatically closed when the code exits the block. using (SqlConnection ConnectionObject = NEW SqlConnection()) To ensure that the database connections are always closed, open the connection inside of a using block, as shown in the following code fragment. Doing so ensures that the connection is automatically closed when the code exits the block. using (SqlConnection ConnectionObject = new SqlConnection()) |
|