数据库中有上万条数据需显示在dataGrid中,是winform程序。在显示时需很长时间才能显示出来。
请问各位有什么好的方法优化吗? 如像web程序那样分页显示。
请问各位有什么好的方法优化吗? 如像web程序那样分页显示。
解决方案 »
- Microsoft Visual C# 2010 Express 怎么新建 windows 服务程序
- 水晶报表 序号
- Atom N280(270)上可以安装使用vs.net和sql吗
- 跨服务器全文检索问题 急!!!
- 急!!!image对象存储到数据库的问题!!100分
- 请教高人Bitmap怎么利用socket传出去?
- 请问用c#开发PDA程序要安装什么补丁之类的东西?
- 求教,有什么比较好的关系系统架构设计方面的书啊?
- 100分求解:在C#中如何将菜单项和工具栏的按钮对应起来???
- 请问在win2000 pro下如何用Visual c#.net实现xp风格的窗体?
- 哪里有 VS2003 或 VS2005 下载的?找了很多都不能下
- 如何判断一个EXE是什么语言写的啊。
查询时,用:
declare @pagenum int --每页的行数
delcare @CurPage int --当前的页数
selecct top @pagennum * from tablename where keycol>@pagenum*@curpage
ordey by keycol
以上是伪代码,给你提供一个思路
再有就是,可以和DataView配合使用。
http://support.microsoft.com/default.aspx?scid=kb;zh-cn;307710
CREATE procedure DocSearchtest
@PageIndex INT,
@PageSize INT,
@RecordCount INT OUT,
@PageCount INT OUT,
@DocName varchar(100),
@KeyWord varchar(50),
@UserName varchar(16)
as
begin
SELECT @RecordCount = COUNT(*) FROM MyDoc_TSET @PageCount = CEILING(@RecordCount * 1.0 / @PageSize)
declare @indextable table(id int identity(1,1),nid int) --定义表变量
declare @PageLowerBound int --定义此页的底码
declare @PageUpperBound int --定义此页的顶码
set @PageLowerBound=@pageindex*@pagesize
set @PageUpperBound=@PageLowerBound+@pagesize
set rowcount @PageUpperBound
insert into @indextable(nid) select Docid from MyDoc_T where DocName like @DocName and KeyWord like @KeyWord and UserName like @UserName
select d.Docid,d.DocName,d.TypeName,d.ShareType,d.CDate,d.KeyWord,d.UserName,d.Fname from MyDoc_T d ,@indextable t
where (d.Docid=t.nid)
and t.id>@PageLowerBound and t.id<=@PageUpperBound
end
GO
http://blog.csdn.net/knight94/archive/2006/03/23/635885.aspx