Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

IAdoOperations.QueryForObject(CommandType, String, IRowMapper, ICommandSetter) Method

Execute a query with the specified command text and parameters set via the command setter, mapping a single result row to an object via a RowMapper.

[Visual Basic]
Public Sub QueryForObject( _
   ByVal cmdType As CommandType, _
   ByVal cmdText As String, _
   ByVal rowMapper As IRowMapper, _
   ByVal commandSetter As ICommandSetter _
)
[C#]
object QueryForObject(
   CommandType cmdType,
   string cmdText,
   IRowMapper rowMapper,
   ICommandSetter commandSetter
);

Parameters

cmdType
The command type.
cmdText
The command text to execute.
rowMapper
object that will map one object per row
commandSetter
The command setter.

Return Value

The single mapped object.

Exceptions

Exception Type Condition
IncorrectResultSizeDataAccessException If the query does not return exactly one row.
DataAccessException If there is any problem executing the query.

See Also

IAdoOperations Interface | Spring.Data Namespace | IAdoOperations.QueryForObject Overload List