为什么winForm放慢速度 [英] why winForm slow down

查看:78
本文介绍了为什么winForm放慢速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了winForm应用程序

使用

1. vs 2012

2. Sqlserver 2012

3 .devcomp

4. 3层架构

程序的执行很好但是当我在我的应用程序上做了更多的工作时,它的开始时间是下降和下降现在需要花费太多时间来启动/执行..当我在我的一个表单上使用此代码时,在我的sql DAL类中特别显示错误 timeout 。为什么我的winform现在减速?

I have develop winForm application
using
1. vs 2012
2. Sqlserver 2012
3. Devcomp
4. 3 tier architecture
The execution of program were fine but by the time i did more work on my application it's starting time going down and down and down Now it take too much time to start/execute.. and specially show an error timeout in my sql DAL class when i use this code on one of my form. why my winform slow down now?

if (clbBooksName.GetItemChecked(0) == true)
           {
               BookSelection = "OR Hadith_Book_Number = 1";
           }
           if (clbBooksName.GetItemChecked(1) == true)
           {
               BookSelection = "OR Hadith_Book_Number = 2";
           }
           if (clbBooksName.GetItemChecked(2) == true)
           {
               BookSelection = "OR Hadith_Book_Number = 3";
           }
           if (clbBooksName.GetItemChecked(3) == true)
           {
               BookSelection = "OR Hadith_Book_Number = 4";
           }
           if (clbBooksName.GetItemChecked(4) == true)
           {
               BookSelection = "OR Hadith_Book_Number = 5";
           }
           if (clbBooksName.GetItemChecked(5) == true)
           {
               BookSelection = "OR Hadith_Book_Number = 6";
           }
           foreach (DataGridViewRow Datarow in dataGridView1.Rows)
           {
               if (Datarow.Cells[0].Value != null && Datarow.Cells[1].Value != null && Datarow.Cells[2].Value != null && Datarow.Cells[3].Value != null)
               {
                   WhereClause += Datarow.Cells[0].Value.ToString() + "= 4";
               }
           }

           SearchQuery = "Select * From Hadiths_old Where Baab_Id < 100 =" + BookSelection + "AND" + WhereClause;
           MessageBox.Show(WhereClause);

推荐答案

如果你要在应用程序启动时检索任何数据库记录。

那么它会ll慢下来。

第一次检查连接是否有用。如果可用,则检索值。

总是使用过程和视图来检索和插入记录。

它使性能更快。

不检索所有记录都意味着在查询中永远不要使用*。

总是检索您需要的列。它使应用程序更快。



希望这些东西可以帮到你..







使用列名。不是*

请联系您的数据库管理员以获取帮助。

作为sql server抛出的超时错误。

重新启动服务器并尝试再次。
if you are retrieving any database records in application start.
then it ll slow down.
1st check connection is avail or not. if avail then retrieve value.
always use procedure and views to retrieve and insert record.
it makes performance faster.
don't retrieve all records mean to say never use "*" in queries.
always retrieve columns that you need. it makes application faster.

Hope these things help you ..



use column names. not "*"
Contact your Database administrator for help.
as its time out error thrown by sql server.
restart the server and try again.


win表单的性能低于MVC,所以请检查是否可以将其从ASP.net win表单更改为MVC



$



你可以通过使用工具进行性能测试来检查你的代码性能并增强你的代码减少循环,检查所有服务器之间的连接SQL server和Application front终端服务器

如果服务器之间的证书过期,它可能是服务器之间的连接问题(它会在每次应用服务器调用SQL服务器时对它进行身份验证)



尝试解决管理服务器的IT专家的问题,并增强您的代码块,它将作为魅力工作,不要担心^ - ^
win forms is less performance than MVC so try check if you can change it from ASP.net win forms to MVC

OR

you can check your code performance by using tools for performance test and enhance your code make less loops , check the connections between all servers SQL server and Application front end servers
it maybe a connection problem between server if certificate between servers expired (it will authenticate every time application server call SQL server it happens with me)

try to troubleshoot the problem with IT specialists who administer servers , and enhance your code blocks and it will work as charm and do not worry ^-^


这篇关于为什么winForm放慢速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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