실행하면 InvalidOperationException이 발생합니다 ("특성 이름을 확인할 수 없음"). 나는 그물을 점검했지만 해결책을 찾지 못했습니다. foreach (연락처의 var c) 행에서 발생합니다.Datacontext를 사용하는 InvalidOperationException
DataContext ctx = new DataContext("CrmConnection");
var contacts = from c in ctx.contacts
where c != null
select new
{
acct = c.parentcustomerid == null ? "" : c.parentcustomerid.name,
last = c.lastname == null ? "" : c.lastname,
first = c.firstname == null ? "" : c.firstname
};
List<string> lines = new List<string>();
try
{
foreach (var c in contacts) *ex*
{
Console.WriteLine(c.acct);
Console.ReadLine();
lines.Add(string.Format("{0}\t{1}\t{2}", c.acct, c.last, c.first));
Console.WriteLine(c.acct);
}
}
catch (Exception ex)
{
Console.WriteLine(String.Format("Error: {0}", ex));
}
아이디어가 있으면 알려주세요. 고맙습니다.
'* ex *'란 무엇입니까? – devuxer
정확한 오류 메시지가 표시 되나요? 더 이상 표시되지 않습니까? – Matt
* ex * 내가 추가 한 내용입니다. – Paul