错误:“ as.Date(20110505,%Y%”)中出现意外的特殊字符

时间:2018-09-27 19:30:03

标签: r

我不确定为什么不能编写以下代码。

var listPerson = new List<PERSON>();
using (var t = DbContext.SingleInstance().Entities)
{
    listPerson.AddRange(t.PERSON);
}

using(var personInformation=DbContext.SingleInstance().TKEntities)
{
    foreach(var p in listPerson)
    {
        personInformation.PERSON.Add(p);
    }
    personInformation.SaveChanges();
}


PERSON TABLE : PersonID,NAME,SURNAME,PERSONFAMILYID,PERSONCOURSEID

PERSONFAMILY TABLE:PersonID,PERSONFAMILYID,PERSONFAMILYNAME,PERSONFAMILYSURNAME

PERSONCOURSE TABLE: PERSONID,COURSEID,COURSENAME

PERSONTABLE-PERSONFAMILY IS ONE TO MANY

PERSONTABLE-PERSONCOURSE IS ONE TO MANY.

我收到标题中给出的错误。有人可以帮我吗?

1 个答案:

答案 0 :(得分:2)

它应该是带有引号format的字符串

as.Date(as.character(20110505), "%Y%m%d")
#[1] "2011-05-05"