Here is the complete code for creating the SQLite database, fill in some data in the table and then try to restore it. If there is an aggregate function in the datetime column, PetaPoco throws an error.
using System; using PetaPoco; class Program { static void Main(string[] args) { bool filenew = false; if (!System.IO.File.Exists(@"c:\temp\database.sq3")) filenew = true; System.Data.SQLite.SQLiteConnection sqltc = new System.Data.SQLite.SQLiteConnection("Data Source=" + @"c:\temp\database.sq3"); sqltc.Open(); PetaPoco.Database db = new Database(sqltc); if (filenew) db.Execute("create table test1 (ID_CHANNEL integer primary key autoincrement, dtfld DateTime null, name string)"); test1 t = new test1(); t.name = "No Date"; db.Insert(t); t = new test1(); t.dtfld = DateTime.Now; t.name = "with date"; db.Insert(t);
Can someone suggest a fix that still means that the POCO object contains the date and time and I can still get the maximum date?
source share