vendredi 13 mars 2015

SQLite.net out of memory error on simple insert

I'm using http://ift.tt/1MyTcyX .


Here is my table class:



class SyncTime
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public DateTime RunTime { get; set; }
}


And my data class which is being called to insert the current datetime into the table.



public class DataLayer
{
SQLiteConnection db;
public DataLayer()
{
// Initialize the database if necessary
using (db = new SQLite.SQLiteConnection(Settings.DBPath))
{
// Create the tables if they don't exist based on DatabaseTables' folder's classes
db.CreateTable<SyncTime>();
}
}

public int InsertSyncTime()
{
// Insert note into the database
var syncTime = new SyncTime { RunTime = DateTime.Now };
return db.Insert(syncTime);
}
}


And here is my call:



private void Sync_Button_Click(object sender, RoutedEventArgs e)
{
renderUI(1);
DataLayer dataLayer = new DataLayer();
dataLayer.InsertSyncTime();
}


And I'm getting a out of memory exception.


enter image description here


What am I doing wrong?


Aucun commentaire:

Enregistrer un commentaire