求“优化以下数据的方法”
我写了一个程序,每次执行完添加操作后都要调用一下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存储过程会快一些吗?
求路人指点一下 谢谢!!!