none
Do I need to Dispose SqlConnection?

    Question

  • Hi,

    I am using this code to close the connection everytime I use it.

    if (event_log_sql_connection != null) { if (event_log_sql_connection.State == ConnectionState.Open) event_log_sql_connection.Close(); }

    I want to ask do I need to also Dispose the connection like this?

    if (event_log_sql_connection != null) { if (event_log_sql_connection.State == ConnectionState.Open) event_log_sql_connection.Close(); event_log_sql_connection.Dispose(); }
    Sunday, June 23, 2013 3:23 PM

Answers

All replies