OleDbDataReader::Close Method ()
Closes the OleDbDataReader object.
Assembly: System.Data (in System.Data.dll)
You must explicitly call the Close method when you are through using the OleDbDataReader to use the associated OleDbConnection for any other purpose.
Caution |
|---|
Do not call Close or Dispose on a Connection, a DataReader, or any other managed object in the Finalize method of your class. In a finalizer, you should only release unmanaged resources that your class owns directly. If your class does not own any unmanaged resources, do not include a Finalize method in your class definition. For more information, see Garbage Collection. |
The following example creates an OleDbConnection, an OleDbCommand, and an OleDbDataReader. The example reads through the data, writing it out to the console. Finally, the example closes the OleDbDataReader, and then the OleDbConnection.
Available since 1.1
OleDbDataReader Class
System.Data.OleDb Namespace
Working with DataReaders
