c# - Cannot convert from 'System.DateTime' to 'System.Data.Linq.Binary' error -


In this program I am currently working, my table has a Create_Timestamp column, Which I defined as the timestamp .

When I am working with my data reference and working on HttpPost in my controller, then I am trying to:

 
news articles article = new news article (); Article.Create_Timestamp = System.DateTime.Now;

The error I get is not changed from ' system.DateTime' to 'System.Data.Linq.Binary'

< P> I ', but I'm not sure what I'm doing at this point.

Is it possible to convert to C # and still Linq is happy with me?

Thank you

I'm thinking that you type the SQL timestamp in your table And you are expecting it to be datetime. The timestamp does not really have to keep date / time information from MSDN (http://msdn.microsoft.com/en-us/library/aa260631 (SQL.80) .aspx):

< P> The timestamp is a data type that automatically exposes the binary number generated, which is guaranteed to be unique within a database, the timestamp is usually used as a mechanism for the version-stamping table rows. . Storage size is 8 bytes. Storage size is 8 bytes.

Change your column "Create_Timestamp" to date, and you should be ok.


Comments