如何在Mvc 4中使用加入查询? [英] How Do I Use Join Query In Mvc 4 ?

查看:81
本文介绍了如何在Mvc 4中使用加入查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

_wishlist wslist = new _wishlist();
            var joinquery = (from mobtab in rdb.mobiletablets
                             join w in rdb.wishlists on mobtab.MobID equals w.MobID
                             join u in rdb.users on w.UID equals u.UID
                             
                             select new
                             {
                                 MobID = mobtab.MobID,
                                 UID = w.UID,
                                 Title = mobtab.ModelName,
                                 Img = mobtab.Image,
                                 Price = mobtab.Price,
                             });
           
            wslist.wlist = joinquery.ToList();
            return View(wslist);

推荐答案

既然你不要让我们知道你在做什么,你得到的最佳答案是 this [ ^ ]。
Since you don't give us any idea of what you're doing, the best answer you're going to get is this[^].


实际上这不是实体框架中实现连接的语法,请参考:



http://www.c-sharpcorner.com/UploadFile/97fc7a/implement-joins-in-entityframewok-using -db-context-and-linq / [ ^ ]
Actually this is not a syntax for implement joins in Entity Framework, Please refer it:

http://www.c-sharpcorner.com/UploadFile/97fc7a/implement-joins-in-entityframewok-using-db-context-and-linq/[^]


这篇关于如何在Mvc 4中使用加入查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆