SELECT * FROM tblHistory WHERE Timestamp > ‘10/07/2010 09:20:52’ ORDER BY Timestamp ASC
I was able to successfully execute this query:
SELECT * FROM tblHistory LIMIT 1
So I know the database is ok. I am getting the following message:
[b]A first chance exception of type ‘GHIElectronics.NETMF.SQLite.SQLiteException’ occurred in GHIElectronics.NETMF.SQLite.dll
Additional information: Could not finalize SQL statement.[/b]
Any ideas what my problem is? Also, how do I search the forum posts? A few days ago there was a drop down button labeled ‘Search’ under ‘Forum’ in the top menu. But now I only see ‘Unread Messages’ and ‘Users’. I don’t see any other place to search posts.
This is an internal error message that comes from SQLite engine. I wish I can give you more information. probably you could find an answer at SQLite website.
[url]http://www.sqlite.org/[/url]
I have successfully used the following commands to read data from the DB:
SELECT * FROM tblHistory
SELECT * FROM tblHistory LIMIT 1
But get errors on the following:
SELECT * FROM tblHistory WHERE Timestamp > ‘10/07/2010 12:26:25’ ORDER BY Timestamp ASC
I have a feeling the error is with the command string itself probably relating to the DATETIME. But I couldn’t find any issues with it looking at the SQLite website.
Also, I open the database upon entering a method and close it (in a finally block) before leaving and don’t have problems until I use the SELECT statement above.
Has anyone tried a statement like this before? … A SELECT … WHERE on a DATETIME object?
Thanks for the help so far Architect. I have put together a solution that creates a database with a single table and performs a few operations on it. What is repro and how do I get the solution out there so someone else can try this?
I didn’t exactly figure out what it was but did fix the issue…so here we go.
SQLite does not have a Date/Time datatype, it will convert it to the type INTEGER. Which gave me that error, so I decided to store the Date/Time ticks as a 64-bit value. Well…SQLite, at least the .NET Micro port, doesn’t seem to support 64-bit values. They go into the database without errors, but come out wrong.
My work around was to create my own reference date (the first second of 2010) and converted the DateTime.Ticks into seconds (divide by 10,000). Then I stored them in the database as unsigned 32-bit integers. This works for me because I only need a minimum resolution of seconds. If my calculations are correct, this should work for about 136 years before it overflows.
Maybe this will help someone, maybe not, but it worked for me.
It definitely helps. I remember reading that date is not supported, but your statement that creation of the table went through OK threw me off. Good tip!