首页 > 解决方案 > C#如何将两个日期与sqlite进行比较

问题描述

我尝试将 Sqlite 中的两个日期与我的 c# 代码进行比较,并且每次比较都返回相同的值。我不知道为什么。

我有两个具有相同值的表,但一个具有下载值,另一个具有本地值。我想同步这两个表。为此,我使用日期值“derniere_modification”,如果必须保存值,则将临时表 temp_mres 更新为 true,如果必须保存在线值,则将其更新为 false。

我的两个代码是:

>//On vérifie les données à mettre à jour dans la table de la tablette
>string sql = "UPDATE temp_mres SET synchronisation = 'true' WHERE julianDay >= (SELECT julianday(derniere_modification) FROM mres WHERE id = temp_mres.id)";
>SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
>command.ExecuteNonQuery();

>//On vérifie les données à mettre à jour en ligne
>string sql2 = "UPDATE temp_mres SET synchronisation = 'false' WHERE julianDay <= (SELECT julianday(derniere_modification) FROM mres WHERE id = temp_mres.id)";
>SQLiteCommand command2 = new SQLiteCommand(sql2, m_dbConnection);
>command2.ExecuteNonQuery();

当我查看我的 temp_mres 表时,我在同步中始终写为真,从不为假。

我的 sqlite 命令看起来对吗?你对我的问题有想法吗?

谢谢。

标签: c#sqlite

解决方案


推荐阅读