Hi,

I'm having problem reading a column which stores a date as smalldatetime in SQL 
Server.  I can write to the column fine using a string property but when I try 
to read it, I get the error pasted below.    I've already tried to specify the 
types explicitly but that didn't work:

<result column="ShipDate" property="ShipDate" type="string" 
dbType="SmallDateTime"/>

The reason I know it's this column that's the problem is because as soon as I 
take it out, everything starts to work again.

Any help is apprecited.  

Here's the error I get:

System.InvalidCastException: Specified cast is not valid.

With the trace:
[InvalidCastException: Specified cast is not valid.]
   System.Data.SqlClient.SqlDataReader.GetSqlString(Int32 i) +46
   System.Data.SqlClient.SqlDataReader.GetString(Int32 i) +32
   
IBatisNet.DataMapper.TypeHandlers.StringTypeHandler.GetValueByName(ResultProperty
 mapping, IDataReader dataReader) +79
   
IBatisNet.DataMapper.Configuration.ResultMapping.ResultProperty.GetDataBaseValue(IDataReader
 dataReader) +32
   
IBatisNet.DataMapper.MappedStatements.MappedStatement.SetObjectProperty(RequestScope
 request, ResultMap resultMap, ResultProperty mapping, Object& target, 
IDataReader reader) +235
   
IBatisNet.DataMapper.MappedStatements.MappedStatement.ApplyResultMap(RequestScope
 request, IDataReader reader, Object resultObject) +241
   
IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForObject(RequestScope
 request, IDalSession session, Object parameterObject, Object resultObject) +133
   
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject(IDalSession
 session, Object parameterObject, Object resultObject) +92
   
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObject(IDalSession
 session, Object parameterObject) +10
   IBatisNet.DataMapper.SqlMapper.QueryForObject(String statementName, Object 
parameterObject) +147


Reply via email to