我想实现的是这样的功能:
A
  1  2  3  4  5  6  7
B
  a  b  c  d  e  f   g  h  i
C
  2  2  2  2  2  2  2  2  2  2  ===================
问题:子DATALIST只要显示前5个就行了!(不是select top 5,这样就有可能找不到前5个了)
想要的显示效果如下
A
  1  2  3  4  5  
B
  a  b  c  d  e 
C
  2  2  2  2  2  把子datalist第5个以后的数据不要显示出来!!==============================================================================
下边这个代码会全部显示出来!请问要怎么解决?
public void bingr()
{
all p = new all();
string strconn = p.strconn();
OleDbConnection cn= new OleDbConnection (strconn);
OleDbDataAdapter da1 = new OleDbDataAdapter("select  * from sclass  where bclassid="+Request.QueryString["bclassid"]+" ",strconn);
DataSet ds = new DataSet();
da1.Fill(ds,"sclass");
OleDbDataAdapter da2 = new OleDbDataAdapter("select  * from pproduct ",strconn);
da2.Fill(ds,"pproduct");
ds.EnforceConstraints=false;
ds.Relations.Add("myrelation",
ds.Tables["sclass"].Columns["sclassid"],
ds.Tables["pproduct"].Columns["sclassname"]);
parentRepeater.DataSource = ds.Tables["sclass"];
Page.DataBind();
cn.Close();
}

解决方案 »

  1.   

    用datagrid的话,每页显5条记录,很好解决
      

  2.   

    就用 select top 5如果数据库里满足条件的记录不足5条就用Add给DataTable增加几条空的记录。
      

  3.   

    "select top 5 * from sclass  where bclassid="+Request.QueryString["bclassid"]+" ",
      

  4.   

    我想要的是这样:第一级无限,第二级只要前5个!楼上的....A
      1  2  3  4  5  
    B
      a  b  c  d  e 
    C
      2  2  2  2  2  
    A
      1  2  3  4  5  
    B
      a  b  c  d  e 
    C
      2  2  2  2  2  
    A
      1  2  3  4  5  
    B
      a  b  c  d  e 
    C
      2  2  2  2  2
      

  5.   

    用DATASET的TABLES的ROWS就可以了呀
    ds.tables["sclass"].rows[1].columns[]
      

  6.   

    http://blog.csdn.net/wj2929/archive/2005/02/13/286932.aspx