System.Data.SQLite
View Ticket
Not logged in
Ticket UUID: e0dd9d702db0761237dae38e11e0ff5137c2d789
Title: "Specified cast is not valid" Error if Boolen Type Column Is In Data Model
Status: Closed Type: Incident
Severity: Important Priority: Medium
Subsystem: Data_Reader Resolution: Works_As_Designed
Last Modified: 2014-01-23 01:57:15
Version Found In: x86-2012-1.0.84.0
User Comments:
anonymous added on 2014-01-10 19:18:44: (text/x-fossil-plain)
When attempting to read a simple query to a table that has a boolen type column mapped that contains any nulls, error {"Exception has been thrown by the target of an invocation."} occurs.

{"Specified cast is not valid."}
InnerException: null
Stacktrace:    at System.Data.SQLite.SQLiteDataReader.VerifyType(Int32 i, DbType typ)
   at System.Data.SQLite.SQLiteDataReader.GetBoolean(Int32 i)

IF ALL BOOLEN COLUMNS THAT CONTAIN NULL ARE REMOVED FROM THE MAP, EVERYTHING WORKS FINE.

mistachkin added on 2014-01-10 20:39:01: (text/x-fossil-plain)
The GetBoolean method is designed to throw an exception for NULL values.  The
GetValue method should be used instead.