0

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;
zkanoca
  • 9,664
  • 9
  • 50
  • 94
  • 1
    possible duplicate of [Failed to convert parameter value from a DateTime to a Byte\[\]](http://stackoverflow.com/questions/9364319/failed-to-convert-parameter-value-from-a-datetime-to-a-byte) – C.Evenhuis Jun 02 '14 at 08:10

2 Answers2

1

If you want to assign DateTime to parameter's value, change its type to SqlDbType.DateTime.

SoftwareFactor
  • 8,430
  • 3
  • 30
  • 34
0

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.

Community
  • 1
  • 1
Lee
  • 2,874
  • 3
  • 27
  • 51