Data type mismatch in criteria expression | Access, OleDb, C#

前端 未结 6 630
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-06 07:44

I read/update data from MS Access using C#. My code is:

public static void UpdateLastLogin(int userid, DateTime logintime) ///logintime = DateTime.Now
{
             


        
6条回答
  •  时光说笑
    2020-12-06 08:15

    Firstly, no your SQL statement should be:

    "UPDATE Customers SET LastLogin=@LastLogin"
    

    Secondly, the reason you are receiving the date mismatch error will probably be your passing '?' as your date time into the LastLogin field instead of the actual logintime parameter.

提交回复
热议问题