实体框架 4。MySQL
我正在尝试将varchar 列映射到类的DateTime属性
我的课:
[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)
);
我收到了这个错误:
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