Ticket Hash: | e9cbf5847dfbd22e7443359684dae8c86d1382d6 | |||
Title: | DataReader unable to read malformed DateTime values using GetValue() | |||
Status: | Closed | Type: | Incident | |
Severity: | Important | Priority: | Medium | |
Subsystem: | Data_Reader | Resolution: | Works_As_Designed | |
Last Modified: | 2014-02-17 22:29:15 | |||
Version Found In: | 1.0.91.0 | |||
User Comments: | ||||
anonymous added on 2014-02-17 08:53:56:
(text/x-fossil-plain)
When attempting to call SQLiteDataReader.GetValue(int) on a column whose data type is "date" and its value is not a valid DateTime value, en exception is thrown: A first chance exception of type 'System.FormatException' occurred in mscorlib.dll Additional information: String was not recognized as a valid DateTime. Expected result: since the generic object GetValue(int) function is called, it must return whatever value is contained in the column. Environment: Win 7 64 bit En System.Data.SQLite.dll 1.0.91 (x86) SQLite.Interop.dll 1.0.91 (x86) Steps to reproduce: create table bug(f1 date); insert into bug values("hello"); IDataReader rdr = open_data_reader_somehow; var value = rdr.GetValue(0); // fails var date = rdr.GetDateTime(0); // fails - as expected in this case var str = rdr.GetString(0); // works - strangely enough - given that the GetValue fails mistachkin added on 2014-02-17 22:29:15: (text/x-fossil-plain) The GetString method should be used to read values that do not conform to their associated type affinity. The behavior of GetValue is correct. |