System.Data.ProviderBase.AbstractDBConnection.Close C# (CSharp) Method

Close() public method

public Close ( ) : void
return void
		public override void Close()
		{
			ConnectionState orig = State;
			try {
				ClearReferences();
				if (JdbcConnection != null && !JdbcConnection.isClosed()) {
					if (!JdbcConnection.getAutoCommit())
						JdbcConnection.rollback();
					JdbcConnection.close();
				}
			}
			catch (Exception e) {
				// suppress exception
#if DEBUG
				Console.WriteLine("Exception catched at Conection.Close() : {0}\n{1}\n{2}",e.GetType().FullName,e.Message,e.StackTrace);
#endif
			}
			finally {
				JdbcConnection = null;
				lock(_internalStateSync) {
					_internalState = ConnectionState.Closed;
				}
			}

			ConnectionState current = State;
			if (current != orig)
				OnStateChange (new StateChangeEventArgs (orig, current));
		}