forked from oysteinkrog/SQLite.Net-PCL
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
I have the following query that insert a DateTime object into the table:
using (SQLiteConnection Connection = new SQLiteConnection(new SQLitePlatformGeneric(), "mydbpath"))
{
Connection.Execute("INSERT INTO punch(user_id, punch_type, punch_time, punch_comment) VALUES(@user_id, @punch_type, @punch_time, @punch_comment)", new object[] { 1, "in", DateTime.UtcNow, "" });
}
I then use the following code to read the date data:
using (SQLiteConnection Connection = new SQLiteConnection(new SQLitePlatformGeneric(), db.ConnectionString))
{
SQLiteCommand cmd = Connection.CreateCommand("SELECT punch_time FROM punch WHERE user_id = @user_id", new object[] { 1 });
var result = cmd.ExecuteDeferredQuery();
}
The data gets written into the database well with 'punch_time' being 636439764482923774.
However, when I get the data back it shows up with the incorrect value of 49290494. This is the value an int would have if it was casted from the long value of the expected date ticks value. It appears the the ExecutedDeferredQuery method is casting it into an int before returning it.
MelbourneDeveloper
Metadata
Metadata
Assignees
Labels
No labels