每10个通讯C#和sql服务器 [英] communication C# and sql server for every 10
问题描述
大家好.我有一个庞大的更新查询,会影响许多记录.出于每种原因,此查询需要3到4分钟才能执行.
不讨论有关优化查询.
我想每10秒钟或更长时间通过c#代码查找此查询情况.
我只想查找查询的情况.例如,记录数每30秒就会受到c#代码的影响.
我也知道如何定期向用户显示新闻.
我应该怎么办? sql server如何对我们说呢?我需要在C#和SQL Server之间进行通信吗?
Hi all. I have a huge update query that effects many many records. in each reason, this query need 3 or 4 minutes for execute.
not discuss about optimize query.
I want to find this query situation by c# code for every 10 seconds or more.
Just I want to find situation of query. for example count of records are affected by c# code in every 30 seconds.
I know how can I show a news for users regularly too.
what should I do? how sql server says this to us? what I need for communication between c# and sql server? Is this possible?
推荐答案
如果我正确理解了您的问题,则希望开始更新,然后每10秒显示进度消息.
您可以使进行更新的存储过程将某种状态指示符写入表,然后从应用程序的线程中每隔10秒检查一次状态指示符.
那就是我首先尝试的方式.
If I understand your question correctly, you want to start the update, and then show progress messages every 10 seconds.
You could make the stored proc that''s doing the update write a status indicator of some kind to a table, and from a thread in your app, check that status indicator every 10 seconds.
That''s the way I''d try it first.
我认为我应该使用TraceServer类.对吧?
I think I should use TraceServer class. right?
这篇关于每10个通讯C#和sql服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!