Closes the connection to the data source. This is the preferred method of closing any open connection.
[Visual Basic] Public Overridable Sub Close() Implements IDbConnection.Close [C#] public virtual void Close(); [C++] public: virtual void Close(); [JScript] public function Close();
The Close method rolls back any pending transactions and then releases the connection. If Close is called while handling a StateChange event, no additional StateChange events are fired.
An application can call Close more than one time. No exception is generated.
Platforms: .NET Compact Framework
.NET Framework Security:
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries From Partially Trusted Code