就是论坛的回复列表显示的问题,两个表一个是放帖子回复的内容【tiezi】,一个是放回复人的信息【huifuren】,我现在的要求是从【tiezi】里读取回复内容加上从【tiezi】里读出回复人的ID然后到【huifuren】表里查询到这个回复人的信息一起绑定到datalist里面显示出来,应该怎么实现?

解决方案 »

  1.   

    datalist绑定数据源时就把两表结合起来进行查询,得到想要的结果,绑定到datalist
      

  2.   

    select * from tiezi,huifuren where 条件
    rptList.datasource = FindAll();   <asp:DataList runat="server" RepeatColumns="3" ID="rptList" OnItemCommand="rptList_ItemCommand">
                            <ItemTemplate>
                                <div id="divPic" style="width: 301px; height: 301px; background-color: Gray;" runat="server">
                                    <img onmouseover="onMouseOver(this)" id='<%#Eval("Id") %>' onmouseout="onMouseOut(this)"
                                        src='../img/Sign/<%#Eval("Photo") %>' width="301px" height="301px" style="cursor: pointer;"
                                        alt="" />
                                    <div id='PcDiv<%#Eval("Id") %>' style="visibility: hidden; width: 301px; position: relative;
                                        height: 50px; top: -50px; color: White; font-weight: bolder; text-align: left;
                                        font-size: 14px;" onmousemove="divPcHi(this)" onmouseover="divPcVi(this)">
                                        &nbsp;&nbsp;&nbsp;&nbsp;<asp:Label runat="server">作品名:<%#Eval("Name") %></asp:Label>
                                        &nbsp;&nbsp;<asp:Label runat="server">作者:<%#Eval("UserInfo_userId.LogName")%></asp:Label>
                                        &nbsp;&nbsp;<asp:Label runat="server">热度:<%#Eval("Count")%></asp:Label>
                                        <br />
                                        &nbsp;&nbsp;&nbsp;&nbsp;<asp:LinkButton CommandArgument='<%#Eval("Id") %>' CommandName="lkBtnAdCount"
                                            runat="server" Font-Size="14px" ForeColor="White" Font-Overline="false">赞一个</asp:LinkButton>
                                    </div>
                                </div>
                            </ItemTemplate>
                        </asp:DataList>
    求分  求分
      

  3.   

    补充下
    重点是这句
    <asp:Label runat="server">作者:<%#Eval("UserInfo_userId.LogName")%></asp:Label>
      

  4.   


    我说的是两个查询得到的结果一起绑定到datalist的啊
      

  5.   

    你直接把两个查询结果合成一张表
    如何不懂可以去这里看看
    http://bbs.suda123.com/Archiver/webbiancheng/thread-113094-1.html