Asp.net网页API MVC
问题描述:
我想在这种方法是增加另一个查询Asp.net网页API MVC
从产品选择这里给其中产品ID = + ID
但由于清单有sales_line提示错误表..如何解决这个问题?谁能帮我?
public List<sales_line> Get(int id)
{
using (project_smartEntities entities = new project_smartEntities())
{
entities.Configuration.ProxyCreationEnabled = false;
return entities.sales_lines.SqlQuery("Select * from sales_line where sales_id=" + id).ToList<sales_line>();
}
}
答
你骗子利用工会SQL
Select *,'a' as type_select from sales_line
union all
Select *,'b' as type_select from sales_line1
+0
它给产品表上的意外的代码错误,这是找不到这行bcz ToList
没有足够的信息来回答你的问题。添加更多的代码,你收到的错误,并更好地解释你的需要 – Bardo
我想申请查询,其中我从产品表中选择*从销售表和product_name ..问题是在列表中,它有销售表,所以它给出错误,因为它没有产品表 –
仍然不清楚您是否尝试加入产品表,或者您有将问题结果映射到模型的问题。至少编辑你的问题,并显示涉及的模型(sales_line,产品),并粘贴确切的错误信息。 –