| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 416 人关注过本帖
标题:求“优化以下数据的方法”
取消只看楼主 加入收藏
zk7580
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-9-16
结帖率:0
收藏
已结贴  问题点数:10 回复次数:0 
求“优化以下数据的方法”
我写了一个程序,每次执行完添加操作后都要调用一下sql中的查询语句更新一次datagridview,当数据多的时候就显示的特别慢,有什么方法能添加完数据后快速的现实datagridview的更新吗?

我的“添加”代码段如下:

if (M_Str_tempt == "add")
                    {
                        string strResult = fwgllei.insert_table(fw);
                        if (strResult == "ok")
                        {
                            MessageBox.Show("添加记录成功");
                        }
                    }


  
con.ConDatabase();

SqlDataAdapter da = new SqlDataAdapter("SELECT fwbh AS 房屋编号, htbh AS 编号, xingming AS 承租人姓名, chengqu AS 所在城区,      jiexiang AS 街巷, xqmingcheng AS 小区名称, loudong AS 所在楼栋, danyuan AS 所在单元, fanghao AS 房号, louceng AS 楼层, jianfangniandai AS 建房年代, chanquanlaiyuan AS 产权来源, jiegou AS 房屋结构,fangwuleixing AS 房屋类型, fangxiang AS 房屋朝向, jianshu AS 房屋间数,      jianzhumianji AS 建筑面积, shiyongmianji AS 使用面积,biaozhunfangjia AS 标准租金, tiaojiehoufangjia AS 调节后租金, yuezujine AS 月租金额, yuanyuezujin AS 原月租金额, jiexianghao AS 年租金, youfujianmian AS 优抚减免, chaobiaojiazu AS 超标加租, qizuriqi AS 起租日期,      tuizuriqi AS 退租日期, pjhm AS 票据号码, diduan AS 收租日期, shoujiaonianyue AS 收交日期, shoujiaojine AS 收交金额, qianzuqiriqi AS 欠租起日期, qianzuzhiriqi AS 欠租止日期,      qianzuzongyueshu AS 欠租总月数, qianzuzongjine AS 欠租总金额, sfzh AS 身份证号, lxdh AS 联系电话,weixiuzywtjz AS 收款人,qianzubeizhu AS 备注 FROM tb_fwgl  where zglzlx='直管房'", con.conn);

DataTable dt = new DataTable();
da.Fill(dt);
this.dataGridView1.DataSource = dt.DefaultView;


如果把这段查询语句写成sql存储过程会快一些吗?

求路人指点一下 谢谢!!!
搜索更多相关主题的帖子: 数据 
2009-09-18 09:58
快速回复:求“优化以下数据的方法”
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015507 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved