Spring.NET 1.3.0 RC1 for .NET 2.0 API Reference

IAdoOperations.QueryForObject(CommandType, String, IRowMapper, String, Enum, Int32, Object) Method

Execute a query with the specified command text and parameter, 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 parameterName As String, _
   ByVal dbType As Enum, _
   ByVal size As Integer, _
   ByVal parameterValue As Object _
)
[C#]
object QueryForObject(
   CommandType cmdType,
   string cmdText,
   IRowMapper rowMapper,
   string parameterName,
   Enum dbType,
   int size,
   object parameterValue
);

Parameters

cmdType
The command type.
cmdText
The command text to execute.
rowMapper
object that will map one object per row
parameterName
The name of the parameter to map.
dbType
One of the database parameter type enumerations.
size
The length of the parameter. 0 if not applicable to parameter type.
parameterValue
The parameter value.

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