日期:2014-05-19  浏览次数:20393 次

关于dataSet里面的dataTable的问题
在一个dataSet中有两个表.而且这两个表里有一个id相关联.
怎么把他们相联起来.并且用datagrid来显示出来呀

------解决方案--------------------
建立关系,和数据库类似
------解决方案--------------------
datarelation建立关系
------解决方案--------------------
mark
------解决方案--------------------
建立关系,和数据库一样的
------解决方案--------------------
<asp:datagrid id= "grid " runat= "server " PageSize= "5 " ShowHeader= "False " AllowPaging= "True " AutoGenerateColumns= "False "
Width= "100% ">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<TABLE cellSpacing= "0 " cellPadding= "0 " width= "100% " border= "0 ">
<TR height= "30 ">
<TD bgColor= ' <%=Application[Session[ "Style "].ToString()+ "xtable_titlebgcolor "]%> '>
<STRONG> <B> 业务岗位:
<%# DataBinder.Eval(Container.DataItem, "StationName ") %>
</B> </STRONG>
</TD>
</TR>
<TR>
<TD align= "right ">
<asp:DataGrid id=dgDetail ShowHeader= "False " runat= "server " AutoGenerateColumns= "False " DataSource= ' <%# ((System.Data.DataRowView)Container.DataItem).CreateChildView( "tableRelation ") %> ' DataKeyField= "CurriculaID " BorderColor= "#336666 " BorderWidth= "1px " CellPadding= "5 " CellSpacing= "0 " GridLines= "Horizontal " Width= "100% " Font-Size= "Smaller ">
<Columns>
<asp:BoundColumn Visible= "False " DataField= "CurriculaID " ReadOnly= "True "> </asp:BoundColumn>
<asp:TemplateColumn HeaderText= "考试课程 ">
<HeaderStyle Width= "400px "> </HeaderStyle>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "CurriculaName ") %>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle HorizontalAlign= "Center " ForeColor= "White " BackColor= "#336666 " Mode= "NumericPages "> </PagerStyle>
</asp:DataGrid>
</TD>
</TR>
</TABLE>
</ItemTemplate>
</asp:TemplateColumn>
<asp:BoundColumn Visible= "False " DataField= "ID " ReadOnly= "True "> </asp:BoundColumn>
<asp:BoundColumn HeaderText= "考试课程 "> </asp:BoundColumn>
</Columns>
<PagerStyle Visible= "False "> </PagerStyle>
</asp:datagrid>