当前位置: 代码迷 >> ASP.NET >> SqlDataSource取分页数据的有关问题,DataSourceSelectArguments(int,int)重载为什么出错
  详细解决方案

SqlDataSource取分页数据的有关问题,DataSourceSelectArguments(int,int)重载为什么出错

热度:8431   发布时间:2013-02-25 00:00:00.0
SqlDataSource取分页数据的问题,DataSourceSelectArguments(int,int)重载为什么出错?
代码如下,就这么3行,最简单的了
C# code
DataSourceSelectArguments dssa = new DataSourceSelectArguments(4, 3);object o = SqlDataSource1.Select(dssa);GridView1.DataSourceID = "SqlDataSource1";


运行后出错,提示信息为:
SqlDataSource“SqlDataSource1”未启用分页。将 DataSourceMode 设置为 DataSet 以启用分页。

实际上SqlDataSource本来就是默认DataSet的啊,而且即使设置了也没用
改成无参数的就正常了
C# code
DataSourceSelectArguments dssa = new DataSourceSelectArguments();

但是我希望直接获取其中某一页的记录

请教,这是什么缘故,如何解决?!?!

------解决方案--------------------------------------------------------
dssa.AddSupportedCapabilities(DataSourceCapabilities.Page);