string sql = "select * from User where sUserName = '" + sUserName + "' AND sUserPassword = '" + sUserPassword + "'";
SQLiteCommand command = new SQLiteCommand(sql, m_dbConnection);
SQLiteDataReader reader = command.ExecuteReader();
if (reader.Read())
{
DateTime Time = reader.GetDateTime(0);
System.DateTime timeNow_FromLocal = System.DateTime.Now;
if (timeNow_FromLocal < Time)
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
我想从sqlite数据库中获取DateTime
以与系统时间进行比较,但是我无法成功reader.GetDateTime(0)
。
答案 0 :(得分:0)
尝试
DateTime Time = DateTime.Parse(reader["columnName"].ToString());