0

I have a column in my table which has a DataType of 'timestamp'. Now I am inserting a row through LINQ2SQL. Now what should I write here:

Entity_Product_Point ev = new Entity_Product_Point();
ev.DateCreated = ???

Thanks!

RG-3
  • 6,088
  • 19
  • 69
  • 125

2 Answers2

5

Are you SURE you wanted timestamp? It has nothing to do with dates... If you'd like to store "DateCreated", I think you probably want to use either a DateTime or just Date datatype in MSSQL. If that's what you really intended, then you can pass in DateTime.Now for a value.

Pete M
  • 2,008
  • 11
  • 17
2

Well the corresponding type would be byte[], but this type is used internally by SQL Server for row versioning—and by ORMs for optimistic locking. You should never (can't) write a value out for a timestamp column manually.

For a more complete listing of which type correspond to what, check out this question

Community
  • 1
  • 1
Adam Rackis
  • 82,527
  • 56
  • 270
  • 393