我有一张桌子,有超过300条记录。 我正在为每条记录做操作LINQ。但它会挂起。
Hi, I have one table in that there are more than 300 records. I am doing operation for each record using LINQ. But it gets hang.
var qryCkeckClocked = (from a in context.sp1 select a); foreach (var scan in qryCkeckClocked) var stud = (from *** }这是我的代码。 我认为查询可以不用迭代到SQL。 请建议我
This is my code. I think the query excutes with no of iteration to SQL. Please suggest me
推荐答案如果你想使用join两个表使用LINQ的Join函数而不是foreach。这个查询将创建像 $ b这样的sql命令$ b If you want to use join two table use Join function of LINQ instead of foreach. This query will create sql command like Select * from context.sp1
因此,您只能选择所需的表,而不是*,这也会缩短查询执行时间。
So instead of * you can select only desired table this will also reduce query execution time.