Click or drag to resize

IDatabaseExecuteReader Method

Returns the SQL data reader associated with the specified SQL query.

Namespace:  AskiaFieldCom.SqlDatabase
Assembly:  AskiaFieldCom (in AskiaFieldCom.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
void ExecuteReader(
	string sql,
	IDictionary<string, Object> parameters,
	Action<IDataReader> callback
)

Parameters

sql
Type: SystemString
SQL query to create the data reader.
parameters
Type: System.Collections.GenericIDictionaryString, Object
List of SQL parameters to apply on the query.
callback
Type: SystemActionIDataReader
Callback action used to manipulate the IDataReader.
Remarks
Examples

Read all records associated with the SQL query.

db.ExecuteReader("SELECT * FROM [Users] WHERE [UserId] = @id", new Dictionary<string, object> {
    {"@id", 1}
}, (reader) =>
{
    while(reader.Read())
    {
        Console.WriteLine(reader["FirstName"]);
    }
});
See Also