我想实现的是这样的功能:
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();
}
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 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
ds.tables["sclass"].rows[1].columns[]