SQL的datetime默认值的问题

时间:2022-09-21 09:59:58

MySQL的datetime设置当前时间为默认值的问题,一般情况下提倡使用TIMESTAMP来代替DATETIME,datetime这个值,如果不使用真实的DateTime来放置值的话,在查询时,就会返回以下错误!

例:

{"输入字符串的格式不正确。"}
[System.FormatException]: {"输入字符串的格式不正确。"}
_className: null
_data: null
_dynamicMethods: null
_exceptionMethod: null
_exceptionMethodString: null
_helpURL: null
_HResult: -2146233033
_innerException: null
_message: "输入字符串的格式不正确。"
_remoteStackIndex: 0
_remoteStackTraceString: null
_source: null
_stackTrace: {sbyte[96]}
_stackTraceString: null
_xcode: -532459699
_xptrs: 0
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
HResult: -2146233033
InnerException: null
IsTransient: false
Message: "输入字符串的格式不正确。"
Source: "mscorlib"
StackTrace: " 在 System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)\r\n在 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)\r\n在 System.Int32.Parse(String s)\r\n 在 Nie.Data.MYYSQL.ExecuteStored(String procedureName, String[,] ps, Int32& Rows)\r\n在 Nie.Data.MYSQLSTATIC.cmdStoredDataTable(String pn, String[,] ps, Int32& rows)"
TargetSite: {Void StringToNumber(System.String, System.Globalization.NumberStyles, NumberBuffer ByRef, System.Globalization.NumberFormatInfo, Boolean)}