且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

我的SqlDependency表单响应缓慢

更新时间:2023-02-13 18:27:31

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

这将导致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).