我的SqlDependency表单响应缓慢 [英] My SqlDependency form responses slowly

查看:156
本文介绍了我的SqlDependency表单响应缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的导师,

我正在从一种形式监视两个sqlserver表,并在两个不同的datagrid和几个标签中显示这些数据.问题是表单响应缓慢,即如果我将其移动.

我有误会吗?使用sqldependency的智能策略应该是什么?

SKPaul

Dear mentors,

i am monitoring two sqlserver tables from one form and showing those data in two different datagrids and few labels. Problem is the form responses slowly i.e. if i move it.

did i mistake anything? what should be the smart policy to use sqldependency?

SKPaul

推荐答案

通过缓慢回复表单,即如果我移动它"是指在屏幕上拖动表单时的意思吗?
如果是这样,我想您正在不断(或至少每分钟几次)轮询数据库并处理数据.

这将导致GUI线程忙".

为避免这种情况,您将必须使用线程并将数据传递给表单.

查看线程和委托(如果您不熟悉,请做一些研究).

除此之外,唯一的方法是在处理数据时阻止任何用户操作(但这不是非常用户友好).
By ''form responses slowly i.e. if I move it'' do you mean when dragging the form across the screen?
If so I''m guessing you are constantly (or at least several times a minute) polling the database and processing the data.

This causes the GUI thread to be ''busy''.

To avoid this you''ll have to use threading and pass the data to the form.

Look in to threading and delegates (do some research if your not familiar with it).

Other than that the only way would be to prevent any user action while you are processing the data (but that''s not very user-friendly).


这篇关于我的SqlDependency表单响应缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆