与linq查询相关的问题... [英] question related to linq queries...

查看:81
本文介绍了与linq查询相关的问题...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SELECT p.Pro_id,
p.Pro_Name,
i.ImageUrl,
pr.Price,
pb.ProBid_price,
d.Discrption,
l.Username,
sh.StartDate,
sh.StartTime,
sh.CloseDate,
sh.CloseTime 

FROM
Tbl_Product p,
Tbl_Image i,
Tbl_Price pr,
Tbl_ProBidPrice pb,
Tbl_Discription d,
Tbl_Login l,
Tbl_BidPlace bp,
Tbl_Schedule sh

where
i.Pro_id=p.Pro_id and
pr.Pro_id=p.Pro_id and
pb.Pro_id=p.Pro_id and
d.Pro_id=p.Pro_id and
sh.Pro_id=p.Pro_id and
l.L_id=bp.L_id and
bp.Bidplace_id = (select max(bp.Bidplace_id) from Tbl_BidPlace bp where bp.Pro_id = P.Pro_id) and
p.Pro_id='" + Request.QueryString["Pro_id"] + "' ";



我怎样才能将此查询用作linq查询....
请给我解决方法
谢谢



how can i use this query as a linq query....
please give me solution
thank you

推荐答案

要将SQL查询转换为LINQ和Vice-Versa,可以使用Linqer.Exe
甚至在此软件中,您也可以检查输出.只需在配置时提供dbml文件和设计器文件路径.
For converting SQL Query to LINQ and Vice-Versa you can use Linqer.Exe
In this software even you can Check the output also.You Just need to give a dbml file and a designer file path while configuring.


^ ]


尝试使用此格式代码,并根据需要进行一些调整

try this format code and do some adjustment regarding to your need

YourEntities ctx = new YourEntities();

var query = from p in ctx.Tbl_Product
                 
	join img in ctx.Tbl_Image on p.Pro_Id equals img.Pro_Id
	join pr in ctx.Tbl_Price on p.Pro_Id equals pr.Pro_Id
	join pb in ctx.Tbl_ProBidPrice on p.Pro_Id equals pb.Pro_Id
	join d in ctx.Tbl_Discription on p.Pro_Id equals d.Pro_Id
	join l in ctx.Tbl_Login on p.Pro_Id equals l.Pro_Id
	join bp in ctx.Tbl_BidPlace on p.Pro_Id equals bp.Pro_Id
	join sh in ctx.Tbl_Schedule on p.Pro_Id equals sh.Pro_Id              
                 
select new 
{ 

p.Pro_Name,
i.ImageUrl,
pr.Price,
pb.ProBid_price,
d.Discrption,
l.Username,
sh.StartDate,
sh.StartTime,
sh.CloseDate,
sh.CloseTime 
};



投票并接受
如果这对您有帮助
谢谢(n_n)



vote and accept
If this will help you
Thanks (n_n)


这篇关于与linq查询相关的问题...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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