Entity Framework 4. MySQL
I am trying to map varchar columns to a DateTime class property
my class:
[Table("webnews_in")] public class WEBNews_in : AbsNews { private DateTime _inDateTimeAdded = DateTime.MinValue; public DateTime InDateTimeAdded { get { return _inDateTimeAdded; } set { _inDateTimeAdded = value; } } private DateTime _inDateTimeUpdated = DateTime.MinValue; public DateTime InDateTimeUpdated { get { return _inDateTimeUpdated; } set { _inDateTimeUpdated = value; } } }
CREATE TABLE webnews_in ( Id INT NOT NULL auto_increment, VPN_AC VARCHAR (20) NULL, InDateTimeAdded VARCHAR (50) NULL, InDateTimeUpdated VARCHAR (50) NULL PRIMARY KEY (Id) );
I got this error:
Input string was not in a correct format. Message Input string was not in a correct format. Data IDictionary (0 items) StackTrace at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at MySql.Data.Types.MySqlDateTime.ParseMySql(String s) at MySql.Data.MySqlClient.MySqlDataReader.GetDateTime(Int32 i) at MySql.Data.Entity.EFMySqlDataReader.GetDateTime(Int32 ordinal) HelpLink null Source mscorlib
Scott 混合 理论
source share