zoukankan      html  css  js  c++  java
  • .net实现主细表DataRelation

    程序代码:

    string sql = "select *  from used_infotype  where superid<=0 order by train asc select * from used_infotype where superid>0";
            DataSet ds = DBHelper.GetDataSet(sql);
            ds.Tables[0].TableName = "used_infotype";
            ds.Tables[1].TableName = "used_infotype2";
            DataColumn Parent = ds.Tables["used_infotype"].Columns["id"];
            DataColumn Child = ds.Tables["used_infotype2"].Columns["superid"];
            DataRelation trelation = new DataRelation("trelation", Parent, Child, false);
            ds.Relations.Add(trelation);
            Repeater3.DataSource = ds.Tables["used_infotype"].DefaultView;      
            Repeater3.DataBind();

    页面代码:

     <asp:Repeater ID="Repeater3" runat="server">
                    <ItemTemplate>
                                  <%# Eval("typename") %>
                      <div style="border-bottom:1px solid #ff0000; height:1px; overflow:hidden; 100%"></div>
                        <asp:Repeater ID="Repeater4" runat="server" DataSource='<%#((System.Data.DataRowView)Container.DataItem).CreateChildView("trelation")%>' DataMember="superid">
                        <ItemTemplate>
                        <%# Eval("typename") %>

                        </ItemTemplate>
                        <SeparatorTemplate>
                        |
                        </SeparatorTemplate>
                        </asp:Repeater>               
                      <br />
                 
                    </ItemTemplate>
                    </asp:Repeater>

  • 相关阅读:
    ksframework的xlua版本
    unity摄像机脚本
    代码重构:用工厂+策略模式优化过多的if else代码块
    在Unity中创建攻击Slot系统
    Unity运用GPU代替CPU处理和计算简单测试
    程序员工具集
    Unity开发-你必须知道的优化建议
    unity向量计算
    ClassFoo-IT知识花园
    BZOJ 3446: [Usaco2014 Feb]Cow Decathlon( 状压dp )
  • 原文地址:https://www.cnblogs.com/kiwifruit/p/1863148.html
Copyright © 2011-2022 走看看