암시 적으로 'short?'유형을 변환 할 수 없습니다. 'short'to LocalAmount = t.EmpNo. 나는 Convert.ToInt16(t.EmpNo)
를 사용하지만 그때 'join'
절에 오류가 발생하고 "incorrect", "type inference failed..."
LINQ : 단락을 단락으로 변환 할 수 없습니까?
public class AccountTransaction
{
public Int16 LocalAmount { get; set; }
public String AccountNumber { get; set; }
}
public static IEnumerable<AccountTransaction> GetAllTransactions()
{
using (var context = new SQL_TA_SCOREBOARDEntities1())
{
return (from t in context.EmployeeAccesses
join acc in context.View_HCM
on t.EmpNo equals acc.EmpNo
select new AccountTransaction
{
LocalAmount = t.EmpNo,
AccountNumber = acc.EmailAddress
}).ToList();
}
}
"켜기 (Int16) t.EmpNo는 acc.EmpNo와 동일하지 않습니다" – Rex
DB 백엔드에서 'EmployeeAccesses.EmpNo'는 명시 적으로'NOT NULL '이 아닌 것으로 추정됩니다. 'public Int16 LocalAmount'을'public Int16'으로 변경하는 것을 고려해보십시오. LocalAmount'. – jdphenix
LINQ-to-SQL 또는 EF를 사용하고 있습니까? 어떤 .NET 버전? – jdphenix