I am not getting your replies Keith; I'm new so maybe it's just delayed. To clarify, I think this is a .NET Sqlite lib problem, not a database issue; sorry for the confusion.
I am currently inserting the data with the Sqlit .NET library using sql with a parameter of datetime type, so If the date is being stored in the wrong format, I would argue that would be a bug the .NET Sqlite lib? Also since the exception is occurring with-in the .NET Sqlite lib so the coercion is happening in the .NET lib., seems weird because I can call datetime.parse and it works, so am not sure what the lib is doing differently. I'm currently using version: 1.0.86.0 of the .NET lib. Eric -----Original Message----- From: eschneider FE [mailto:eschnei...@frozenelephant.com] Sent: Saturday, May 25, 2013 1:32 PM To: 'sqlite-users@sqlite.org' Subject: .net reading date fields not working? Hello, Having problem reading dates using a data reader. Looks like a bug in SqLite? Schema: CREATE TABLE [Errors] ( "ErrorId" integer PRIMARY KEY AUTOINCREMENT NOT NULL, "Date" datetime NOT NULL, "Error" text(2147483647) NOT NULL COLLATE NOCASE ) Data: "1" "5/25/2013 1:18:20 PM" "Test 333 5/25/2013 1:18:20 PM" "2" "5/25/2013 1:18:30 PM" "Test 333 5/25/2013 1:18:30 PM" Code: Public Shared Function ObtainColumnValue(ByVal column As DatabaseColumn, ByVal reader As IDataReader) As Object If column Is Nothing Then Throw New ArgumentNullException("column") If reader Is Nothing Then Throw New ArgumentNullException("reader") If column.DatabaseColumnIndex <= 0 Then Try column.DatabaseColumnIndex = reader.GetOrdinal(column.DatabaseColumnName) Catch ex As IndexOutOfRangeException Throw New DatabaseColumnNotFoundException("Column: " + column.DatabaseColumnName + " not found for property: " + column.MappedPropertyName, ex) End Try End If Return reader(column.DatabaseColumnIndex) End Function Error: Test Name: TestSimpleQuery Test FullName: SqlLiteTestProject.SqlLiteUnitTest.TestSimpleQuery Test Source: D:\Dev\FrozenElephant\SymbioticORM\Symbiotic\SqlLiteTestProject_VB\SqlLiteUn itTest.vb : line 290 Test Outcome: Failed Test Duration: 0:00:00.04931 Result Message: Test method SqlLiteTestProject.SqlLiteUnitTest.TestSimpleQuery threw exception: System.FormatException: String was not recognized as a valid DateTime. Result StackTrace: at System.DateTime.ParseExact(String s, String[] formats, IFormatProvider provider, DateTimeStyles style) at System.Data.SQLite.SQLiteConvert.ToDateTime(String dateText, SQLiteDateFormats format, DateTimeKind kind) at System.Data.SQLite.SQLite3.GetDateTime(SQLiteStatement stmt, Int32 index) at System.Data.SQLite.SQLite3.GetValue(SQLiteStatement stmt, SQLiteConnectionFlags flags, Int32 index, SQLiteType typ) at System.Data.SQLite.SQLiteDataReader.GetValue(Int32 i) at FrozenElephant.Symbiotic.DataReaderHelper.ObtainColumnValue(DatabaseColumn column, IDataReader reader) in D:\Dev\FrozenElephant\SymbioticORM\Symbiotic\Symbiotic\DataReaderHelper.vb:l ine 147 at FrozenElephant.Symbiotic.DataReaderHelper.LoadItem[T](T newItem, IDataReader reader, IList`1 columns) in D:\Dev\FrozenElephant\SymbioticORM\Symbiotic\Symbiotic\DataReaderHelper.vb:l ine 102 at FrozenElephant.Symbiotic.DataReaderHelper.DataReaderToObject[T](IDataReader reader, IList`1 columns) in D:\Dev\FrozenElephant\SymbioticORM\Symbiotic\Symbiotic\DataReaderHelper.vb:l ine 91 at FrozenElephant.Symbiotic.ObjectLoader.ObtainItems[T](IDatabaseTypesFactory factory, ISqlQuery sql) in D:\Dev\FrozenElephant\SymbioticORM\Symbiotic\Symbiotic\ObjectLoader.vb:line 468 at SqlLiteTestProject.SqlLiteUnitTest.TestSimpleQuery() in D:\Dev\FrozenElephant\SymbioticORM\Symbiotic\SqlLiteTestProject_VB\SqlLiteUn itTest.vb:line 296 Frozen Elephant Inc. 739 N. Thomphson Dr. #207 Madison, WI 53704 Eric Schneider (414) 975-3582 eschnei...@frozenelephant.com www.FrozenElephant.com <http://www.frozenelephant.com/> _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users