I am getting this exception: "Fatal error encountered during command execution."
My current code looks like this:
internal void UpdateLastLogin(string userEmail)
{
DateTime today = DateTime.Now;
using (_msqlCon = new MySqlConnection(_connectionString))
{
_msqlCon.Open();
_query = "UPDATE Regs SET `LastLogin` = ?today WHERE Email = ?userEmail";
_command = new MySqlCommand(_query, _msqlCon);
_command.ExecuteNonQuery();
}
}
The column: LastLogin
has Datatype date
What I tried at first before searching more info, was:
_query = "UPDATE Regs SET LastLogin = ?today WHERE Email = ?userEmail";
I have also tried:
_query = "UPDATE Regs SET `LastLogin` = `?today` WHERE Email = ?userEmail";
Notice that the difference is the quot marks on the columns and the variable. Where am I going wrong?
Ps. The column Email
has type VarChar