SqlMapperExecuteReader Method (IDbConnection, String, Object, IDbTransaction, NullableInt32, NullableCommandType) |
Namespace: DapperAssembly: VirtualRadar.Database (in VirtualRadar.Database.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax public static IDataReader ExecuteReader(
this IDbConnection cnn,
string sql,
Object param = null,
IDbTransaction transaction = null,
Nullable<int> commandTimeout = null,
Nullable<CommandType> commandType = null
)
<ExtensionAttribute>
Public Shared Function ExecuteReader (
cnn As IDbConnection,
sql As String,
Optional param As Object = Nothing,
Optional transaction As IDbTransaction = Nothing,
Optional commandTimeout As Nullable(Of Integer) = Nothing,
Optional commandType As Nullable(Of CommandType) = Nothing
) As IDataReader
public:
[ExtensionAttribute]
static IDataReader^ ExecuteReader(
IDbConnection^ cnn,
String^ sql,
Object^ param = nullptr,
IDbTransaction^ transaction = nullptr,
Nullable<int> commandTimeout = nullptr,
Nullable<CommandType> commandType = nullptr
)
[<ExtensionAttribute>]
static member ExecuteReader :
cnn : IDbConnection *
sql : string *
?param : Object *
?transaction : IDbTransaction *
?commandTimeout : Nullable<int> *
?commandType : Nullable<CommandType>
(* Defaults:
let _param = defaultArg param null
let _transaction = defaultArg transaction null
let _commandTimeout = defaultArg commandTimeout null
let _commandType = defaultArg commandType null
*)
-> IDataReader
Parameters
- cnn
- Type: System.DataIDbConnection
- sql
- Type: SystemString
- param (Optional)
- Type: SystemObject
- transaction (Optional)
- Type: System.DataIDbTransaction
- commandTimeout (Optional)
- Type: SystemNullableInt32
- commandType (Optional)
- Type: SystemNullableCommandType
Return Value
Type:
IDataReaderAn
IDataReader that can be used to iterate over the results of the SQL query.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IDbConnection. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks
This is typically used when the results of a query are not processed by Dapper, for example, used to fill a
DataTable
or
DataSet.
Examples DataTable table = new DataTable("MyTable");
using (var reader = ExecuteReader(cnn, sql, param))
{
table.Load(reader);
}
See Also