尝试插入datetime时出现MySQL错误

时间:2017-05-08 18:17:52

标签: c# mysql datetime

出现这样的问题不是时间之后的事情!

编辑:

MySqlCommand cmd = new MySqlCommand();
cmd.CommandText = 
    String.Format("INSERT INTO matches VALUES ({0}, {1}, {2}), {3}, {4}, {5}, {6}", 
        matchid, status, team1, team2, fixteam1logo, fixteam2logo, matchtime);
cmd.Connection = conn;
cmd.ExecuteNonQuery();

感谢任何帮助!

1 个答案:

答案 0 :(得分:0)

如果它是日期列或日期时间列,只需将值作为字符串传递:

somedate='2017-05-08 19:19:23' // for a datetime column
somedate='2017-05-08' // for a date column