本文介绍了显示关联表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果您能帮助解决我的代码遇到的一些问题,我将不胜感激. 我正在使用实体框架模型.在LINQ的帮助下,我正在尝试在单个查询中加载实体及其关联的数据(即实现急切的加载). 这是隐藏的代码:
I will appreciate it if you help me with some problems I encountered with my code. I am working with the Entity Framework model. With the help of LINQ, I am trying to load entities and their associated data in a single query (i.e. to implement eager loading). Here''s the code-behind:
protected void btn5_Click(object sender, EventArgs e) { using (EStoreEntities ctx5 = new EStoreEntities()) { var query =(from o in ctx5.Order_Details.Include("Order") select o); //Order-navigation property tb5.Text = (queryas ObjectQuery).ToTraceString(); gv5.DataSource = query; gv5.DataBind(); } }我正在使用以下ASP代码:
I''m using the following ASP code:
<asp:Button ID="btn5" runat="server" Text="Button" onclick="btn5_Click" /> <asp:GridView ID="gv5" runat="server"></asp:GridView> <asp:TextBox ID="tb5" runat="server" TextMode="MultiLine"></asp:TextBox>如何修复代码以使Order表内容显示在GridView控件中? 预先谢谢您.
How do I fix my code to make the Order table content display in my GridView control? Thank you in advance.
推荐答案您好,请勾选此项将对您有所帮助.. developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx [ ^ ] 检查一下以供参考 希望对您有帮助 谢谢.. 不要投票:) Hi check this it will help you.. developers.de/blogs/damir_dobric/archive/2008/06/14/linq-orderby-and-dynamic-query-sample.aspx[^] check this for your reference hope it helps thanks.. don''t for get to vote:)
更多推荐
显示关联表
发布评论