最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

如何减少LINQ查询的执行时间

SEO心得admin77浏览0评论
本文介绍了如何减少LINQ查询的执行时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一张桌子,有超过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.

发布评论

评论列表(0)

  1. 暂无评论