示例代码段:
command.Parameters.Add(new MySqlParameter("@Created_Date", MySqlDbType.Datetime)).Value = DateTime.Now;
存储过程中的声明" Created_Date DATETIME"
error code: Input string was not in a correct format.
答案 0 :(得分:0)
试试这个:
command.Parameters.Add(new MySqlParameter("@Created_Date", MySqlDbType.Timestamp)).Value = DateTime.Now;
答案 1 :(得分:-1)
MySqlDbType.Datetime
枚举值已过时,请改用MySqlDbType.DateTime
。
Difference between DateTime and Timestamp in MySql
在您的情况下,只需使用command.Parameters.AddWithValue("@Created_Date", DateTime.Now)