显示关联表

编程入门 行业动态 更新时间:2024-10-26 23:41:46
本文介绍了显示关联表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果您能帮助解决我的代码遇到的一些问题,我将不胜感激. 我正在使用实体框架模型.在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:)

更多推荐

显示关联表

本文发布于:2023-10-23 19:57:57,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1521859.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!