How are you storing the dates in the DB? Is the WHERE clause using the same 
format?

Given SQLite's "duck" typing, I don't believe there is any built in definition 
of a date time type.  MSSQL, for instance, has a built in "datetime" type, and 
when you build a WHERE clause with, e.g. a string, SQL Server automatically 
does the conversion. MySQL might be doing the same. 

SQLite doesn't do that, IME, so you must ensure that the writers and the 
readers are all using the same format, whether that be ticks, Julian date, ISO 
8601, or whatever. 

> On Apr 27, 2016, at 07:23, Markus Amshove <markus at amshove.org> wrote:
> 
> Hello,
> 
> 
> 
> I'm using the "System.Data.SQLite.Core" lib to connect to a sqlite-database
> and try to query a dataset by using DateTime in the WHERE clause.
> 
> 
> 
> If I directly use the DateTime object as parameter to the WHERE clause I
> don't get any result. 
> 
> If I reproduce this against, for example, a MySQL database it handles the
> paramter correctly.
> 
> 
> 
> I started a discussion at 
> 
> https://www.reddit.com/r/csharp/comments/4gexh6/cant_query_datetime_in_sqlit
> edapper/
> 
> which let me to the conclusion that it might be a bug in the SQLite driver.
> 
> 
> 
> It seems to be dependent on the culture that my application is running in. 
> 
> Here the gist:
> 
> https://gist.github.com/anonymous/0e11f74f075231f5c5be3dcc0dd7510b
> 
> 
> 
> The following nuget packages were used:
> 
> Dapper, System.Data.SQLite.Core, FluentMigrator, FluentMigrator.Runner
> 
> 
> 
> What I expect is that "QueryAndFilterDatabaseSide" also returns one record.
> 
> 
> 
> Best regards
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to