Method ToDataTables
- Namespace
- Open.Database.Extensions.Synchronous
- Assembly
- Open.Database.Extensions.Core.dll
ToDataTables(IDbCommand, CommandBehavior)
Executes a reader and loads each result set into its own DataTable.
public static List<DataTable> ToDataTables(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.
It calls NextResult() to check for more results.
Exceptions
- ArgumentNullException
commandis null.