Linq 2个表连接问题
public List<fuction> Getlist(string School)
{
Db_Jst_ChatgroupDataContext S_Info = new Db_Jst_ChatgroupDataContext();
IQueryable<fuction> item = from G_info in S_Info.Group_Info1
join G_School in S_Info.Group_SchoolInfo on G_info.Gschool equals G_School.Gschool
where G_info.Gschool.Equals(School)
select new fuction
{
省份 = G_info.Gprovince,
学校 = G_info.Gschool,
班级 = G_info.GroupName,
联系人 = G_School.Contact,
联系邮箱 = G_School.Email,
联系电话 = G_School.Tel
};
return item.ToList();
}
public List<fuction> Getlist(string School)
{
Db_Jst_ChatgroupDataContext S_Info = new Db_Jst_ChatgroupDataContext();
IQueryable<fuction> item = from G_info in S_Info.Group_Info1
join G_School in S_Info.Group_SchoolInfo on G_info.Gschool equals G_School.Gschool
where G_info.Gschool.Equals(School) && (G_School.Contact!=""
[其他解释]
G_School.Contact != null)
select new fuction
{
省份 = G_info.Gprovince,
学校 = G_info.Gschool,
班级 = G_info.GroupName,
联系人 = G_School.Contact,
联系邮箱 = G_School.Email,
联系电话 = G_School.Tel
};
return item.ToList();
}
public List<fuction> Getlist(string School)
{
Db_Jst_ChatgroupDataContext S_Info = new Db_Jst_ChatgroupDataContext();
IQueryable<fuction> item = from G_info in S_Info.Group_Info1
join G_School in S_Info.Group_SchoolInfo on G_info.Gschool equals G_School.Gschool
where G_info.Gschool.Equals(School) && !sting.IsNullOrEmpty(G_School.Contact)
select new fuction
{
省份 = G_info.Gprovince,
学校 = G_info.Gschool,
班级 = G_info.GroupName,
联系人 = G_School.Contact,
联系邮箱 = G_School.Email,
联系电话 = G_School.Tel
};
return item.ToList();
}
public List<fuction> Getlist(string School)
{
Db_Jst_ChatgroupDataContext S_Info = new Db_Jst_ChatgroupDataContext();
IQueryable<fuction> item = from G_info in S_Info.Group_Info1
join G_School in S_Info.Group_SchoolInfo on G_info.Gschool equals G_School.Gschool
where ""!=G_School.Contact
where G_info.Gschool.Equals(School)
select new fuction
{
省份 = G_info.Gprovince,
学校 = G_info.Gschool,
班级 = G_info.GroupName,
联系人 = G_School.Contact,
联系邮箱 = G_School.Email,
联系电话 = G_School.Tel
};
return item.ToList();
}