如何动态的从数据库读出数据去构建一个象csdn里的设置自定义社区 一样的页面 取数据库的内容保存到xml文件,再用JS从xml文件中取出 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我觉的从数据库读出一个DataSet就完全可以了,为什么一定要用XML呢!页面用嵌套式的DataList 数据库里格式为XML配合相应的XSL,有信箱吗?我可以发个相似的例子你 KentYu(潜水的鱼) 发了么?我没有收到,能不能再发一下 string body=""; body=body+"<table cellPadding=3 cellSpacing=1 align=center width=100%>"; for(i=count;i<total;i++) { string query3="select * from userinfo where account='"+das.Tables["reply"].Rows[i]["account"].ToString()+"'"; OleDbDataAdapter dp=new OleDbDataAdapter(query3,conn); DataSet dst=new DataSet(); dp.Fill(dst,"userinfo"); body=body+"<tr bgcolor=#f2f8ff><td width=30% height=145 valign=top><img src="+dst.Tables["userinfo"].Rows[0]["face"].ToString()+" border=0><br>"; body=body+" 用户名: "+das.Tables["reply"].Rows[i]["account"].ToString()+"<br>"; body=body+" 头衔: "+dst.Tables["userinfo"].Rows[0]["rank"].ToString()+"<br>"; body=body+" 等级: "+dst.Tables["userinfo"].Rows[0]["grade"].ToString()+"<br>"; body=body+" 经验值: "+dst.Tables["userinfo"].Rows[0]["gold"].ToString()+"<br>"; body=body+" 来自: "+dst.Tables["userinfo"].Rows[0]["comefrom"].ToString()+"<br>"; body=body+" 总发贴: <br>"; body=body+" 注册: "+dst.Tables["userinfo"].Rows[0]["addtime"]+"<br></td>"; body=body+"<td width=70% valign=top height=145 bgcolor=#f2f8ff><br><hr width=100% color=#0099cc size=1><br>"+das.Tables["reply"].Rows[i]["content"].ToString()+""; body=body+"<br><br><br><br><hr width=100% size=1 color=#0099cc>"; body=body+"</td></tr>"; dst.Clear(); dst.Dispose(); } 我自己解决了方法有两种,用DataRelation或是使用DataView我用了DataView的RowFilter方法,大家可以参考ASP技术内幕12章的NestedRowFilter.aspx <asp:Repeater ID="parentRepeater" Runat="server"> <ItemTemplate> <b> <%# DataBinder.Eval(Container.DataItem,"FUNCTIONNAME") %> </b> <br> <asp:Repeater ID="childRepeater" Runat="server" DataSource='<%# FilterFunc((string)DataBinder.Eval(Container.DataItem,"FUNCTIONID")) %>'> <ItemTemplate> <input type="checkbox" name="strItem" value='<%# DataBinder.Eval(Container.DataItem, "FUNCTIONID" )%>' <%# DataBinder.Eval(Container.DataItem, "SPARE_MES" )%>><%# DataBinder.Eval(Container.DataItem, "FUNCTIONNAME" )%> <br> </ItemTemplate> </asp:Repeater> </ItemTemplate> </asp:Repeater> private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 CLASS_ID.Text = Request.QueryString["CLASS_ID"]; SUB_CLASS.Text = Request.QueryString["SUB_CLASS"]; CODE.Text = Request.QueryString["CODE"]; NAME.Text = Request.QueryString["NAME"]; SysFuncSystem sfs = new SysFuncSystem(); DataSet ds = sfs.GetFuncTreeByPurviewForSet(CODE.Text); DataSet dsChild = ds.Copy(); DataView dvParent = ds.Tables["SysFuncInfo"].DefaultView; dvChild = dsChild.Tables["SysFuncInfo"].DefaultView; dvParent.RowFilter = "PARENTID = '0'"; dvChild.RowFilter = "PARENTID <> '0'"; parentRepeater.DataSource = dvParent; parentRepeater.DataBind(); } public DataView FilterFunc(string parentID) { dvChild.RowFilter = "PARENTID = '" + parentID + "'"; return dvChild; } 请问List的ForEach方法 获取计算机文件大小??????????????????? 请教一下会的朋友 救命!在线等 断行。。。。。 编写win32服务程序 DataGridView 疑问 请教各位朋友一个问题:为什么我页面初始化无效,我刚接触C#有些不懂? winform 打开网页关闭网页的问题 c#数据库如果实现事务操作 找不到类型或命名空间名称“XmlElement”(是否缺少 using 指令或程序集引用?) 高手指点
body=body+"<table cellPadding=3 cellSpacing=1 align=center width=100%>";
for(i=count;i<total;i++)
{ string query3="select * from userinfo where account='"+das.Tables["reply"].Rows[i]["account"].ToString()+"'";
OleDbDataAdapter dp=new OleDbDataAdapter(query3,conn);
DataSet dst=new DataSet();
dp.Fill(dst,"userinfo");
body=body+"<tr bgcolor=#f2f8ff><td width=30% height=145 valign=top><img src="+dst.Tables["userinfo"].Rows[0]["face"].ToString()+" border=0><br>";
body=body+" 用户名: "+das.Tables["reply"].Rows[i]["account"].ToString()+"<br>";
body=body+" 头衔: "+dst.Tables["userinfo"].Rows[0]["rank"].ToString()+"<br>";
body=body+" 等级: "+dst.Tables["userinfo"].Rows[0]["grade"].ToString()+"<br>";
body=body+" 经验值: "+dst.Tables["userinfo"].Rows[0]["gold"].ToString()+"<br>";
body=body+" 来自: "+dst.Tables["userinfo"].Rows[0]["comefrom"].ToString()+"<br>";
body=body+" 总发贴: <br>";
body=body+" 注册: "+dst.Tables["userinfo"].Rows[0]["addtime"]+"<br></td>";
body=body+"<td width=70% valign=top height=145 bgcolor=#f2f8ff><br><hr width=100% color=#0099cc size=1><br>"+das.Tables["reply"].Rows[i]["content"].ToString()+"";
body=body+"<br><br><br><br><hr width=100% size=1 color=#0099cc>";
body=body+"</td></tr>";
dst.Clear();
dst.Dispose();
}
方法有两种,用DataRelation
或是使用DataView
我用了DataView的RowFilter方法,大家可以参考ASP技术内幕12章的NestedRowFilter.aspx <asp:Repeater ID="parentRepeater" Runat="server">
<ItemTemplate>
<b>
<%# DataBinder.Eval(Container.DataItem,"FUNCTIONNAME") %>
</b>
<br>
<asp:Repeater ID="childRepeater" Runat="server" DataSource='<%# FilterFunc((string)DataBinder.Eval(Container.DataItem,"FUNCTIONID")) %>'>
<ItemTemplate>
<input type="checkbox" name="strItem" value='<%# DataBinder.Eval(Container.DataItem, "FUNCTIONID" )%>' <%# DataBinder.Eval(Container.DataItem, "SPARE_MES" )%>><%# DataBinder.Eval(Container.DataItem, "FUNCTIONNAME" )%>
<br>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
CLASS_ID.Text = Request.QueryString["CLASS_ID"];
SUB_CLASS.Text = Request.QueryString["SUB_CLASS"];
CODE.Text = Request.QueryString["CODE"];
NAME.Text = Request.QueryString["NAME"]; SysFuncSystem sfs = new SysFuncSystem();
DataSet ds = sfs.GetFuncTreeByPurviewForSet(CODE.Text);
DataSet dsChild = ds.Copy(); DataView dvParent = ds.Tables["SysFuncInfo"].DefaultView;
dvChild = dsChild.Tables["SysFuncInfo"].DefaultView;
dvParent.RowFilter = "PARENTID = '0'";
dvChild.RowFilter = "PARENTID <> '0'"; parentRepeater.DataSource = dvParent;
parentRepeater.DataBind(); }
public DataView FilterFunc(string parentID)
{
dvChild.RowFilter = "PARENTID = '" + parentID + "'";
return dvChild;
}