Reputation: 6188
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!
Upvotes: 0
Views: 2017
Reputation: 2048
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.
Upvotes: 5
Reputation: 83376
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
Upvotes: 2