Method ToDataTable
- Namespace
- Open.Database.Extensions.Synchronous
- Assembly
- Open.Database.Extensions.Core.dll
ToDataTable(IDbCommand, CommandBehavior)
Executes a reader and loads its first result set into a DataTable.
public static DataTable ToDataTable(this IDbCommand command, CommandBehavior behavior = CommandBehavior.SequentialAccess)
Parameters
commandIDbCommandThe IDbCommand to generate a reader from.
behaviorCommandBehaviorThe behavior to use with the data reader. The default is SequentialAccess.
Returns
Remarks
The connection is opened if it is closed, and closed again when the call finishes; a connection that was already open is left as it was. A connection this call opened is also closed, never disposed, when the reader cannot be created.
Exceptions
- ArgumentNullException
commandis null.