取数据库的内容保存到xml文件,再用JS从xml文件中取出

解决方案 »

  1.   

    我觉的从数据库读出一个DataSet就完全可以了,为什么一定要用XML呢!页面用嵌套式的DataList
      

  2.   

    数据库里格式为XML配合相应的XSL,有信箱吗?我可以发个相似的例子你
      

  3.   

    KentYu(潜水的鱼) 发了么?我没有收到,能不能再发一下
      

  4.   

    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+"&nbsp;&nbsp;用户名:&nbsp;&nbsp;"+das.Tables["reply"].Rows[i]["account"].ToString()+"<br>";
    body=body+"&nbsp;&nbsp;头衔:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+dst.Tables["userinfo"].Rows[0]["rank"].ToString()+"<br>";
    body=body+"&nbsp;&nbsp;等级:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+dst.Tables["userinfo"].Rows[0]["grade"].ToString()+"<br>";
    body=body+"&nbsp;&nbsp;经验值:&nbsp;&nbsp;"+dst.Tables["userinfo"].Rows[0]["gold"].ToString()+"<br>";
    body=body+"&nbsp;&nbsp;来自:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+dst.Tables["userinfo"].Rows[0]["comefrom"].ToString()+"<br>";
    body=body+"&nbsp;&nbsp;总发贴:&nbsp;&nbsp;<br>";
    body=body+"&nbsp;&nbsp;注册:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"+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();
    }
      

  5.   

    我自己解决了
    方法有两种,用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;
    }