缺少请找到该查询我得到确切的结果LINQ查询属性从LINQ查询结果
var result = (
from sd in students
select sd.Student_ID
).Except(
from m in query1
select m.Student_ID
).ToList();
以下。现在我想填充学生的其他数据,所以我所做的是写其他linq查询。在这里,但我没有得到r.Student_ID属性与学生表进行比较。智能感知不给r.Student_ID。请帮忙!
var finalResult = (
from sd in dbcDefaulter.Student_Details
from r in result
where r == sd.Student_ID
orderby sd.Student_ID
select new { sd.Student_ID, sd.Name, sd.Class, sd.Section, sd.F_Name, sd.F_Mobile }
).Distinct().ToList();
请找到Student_Details类的完整designer.cs
here
部分看起来是这样的:
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Student_Detail")]
public partial class Student_Detail
{
private int _Student_ID;
private string _Class;
private string _Section;
private string _Session;
private string _Name;
private System.Nullable<System.DateTime> _B_Date;
private string _E_Mail;
private string _Gender;
private string _F_Name;
//From Jesse: Please insert the property definition for Student and/or Students, and/or Student_ID here if available.
}
的get set
属性的一部分是这样的:
public DefaulterDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) :
base(connection, mappingSource)
{
OnCreated();
}
public System.Data.Linq.Table<Student_Detail> Student_Details
{
get
{
return this.GetTable<Student_Detail>();
}
}
public System.Data.Linq.Table<Fees_Due> Fees_Dues
{
get
{
return this.GetTable<Fees_Due>();
}
}
请找0123的定义和students
,我们已经在第一个查询中使用了result
。所以query1
是 -
var query1 = (from fd in dbcDefaulter.Fees_Dues
join sd in dbcDefaulter.Student_Details on Convert.ToInt32(fd.Student_ID) equals sd.Student_ID
where fd.Session == GlobalVariables.Session && (fd.Month.Contains(cmbMonth.SelectedItem.ToString()))
orderby fd.Student_ID
select new { sd.Student_ID, fd.Month, fd.Session }).Distinct();
和students
是 -
var students = (from sd in dbcDefaulter.Student_Details
select sd).ToList();
对不起;(,我是新手,我的LINQ不明白你是什么意思,请你给我一个样品/例如? – 2014-09-20 10:21:49
请改为将其编辑到您的问题 – 2014-09-20 14:09:08
什么是列表中的''列表'?'是什么类型的? – 2014-09-20 14:09:49