简体   繁体   中英

TimeStamp , {“Failed to convert parameter value from a DateTime to a Byte[].”}

getting the error

{"Failed to convert parameter value from a DateTime to a Byte[]."}

i have tried time-stamp but getting the error

cmd.Parameters.Add("@DATETIME", SqlDbType.Timestamp).Value = DateTime.Now;

如果要将DateTime分配给参数的值,请将其类型更改为SqlDbType.DateTime。

Sql server's timestamp is not a date/time, so you can't convert it to a datetime and vice versa.

See a detailed explanation here

Use datetime instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM