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

前端 未结 6 634
佛祖请我去吃肉
佛祖请我去吃肉 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条回答
  •  猫巷女王i
    2020-12-06 08:23

    I solved this using the following code

    OleDbCommand cmd = new OleDbCommand(qry, cnn);
    cmd.Parameters.Add("datenow", OleDbType.Date);
    cmd.Parameters["datenow"].Value = DateTime.Now;
    

提交回复
热议问题