将存储过程与linq一起使用到SQL

编程入门 行业动态 更新时间:2024-10-11 21:29:26
本文介绍了将存储过程与linq一起使用到SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我使用以下存储过程,但我不知道如何将它与Linq to Sql一起使用. 我将常规存储过程与Linq to Sql一起使用,但是此存储过程基于两个表检索数据. 如何使用Linq to Sql做到这一点? 请帮我.提前谢谢.

Hi I use the following stored procedure, but i do not know how i can use this with Linq to Sql. I use the normal stored procedure with Linq to Sql, but this stored procedure retrieves data based on two tables. How can I do this with Linq to Sql? Please help me. Thanks in advance.

ALTER PROCEDURE dbo.PackageTestForPerform ( @Package_ID int, @Patient_ID nvarchar(50) ) AS select t.dep_name,t.test_name,t.sub_test_name, CASE WHEN ISNULL(( SELECT COUNT(*) from Patient_Package_Test p where patient_Id=@Patient_ID and p.test_code=t.test_code and p.Sub_Test_id=t.Sub_Test_code ),0)>0 THEN 'TRUE' ELSE 'FALSE' END AS [Status] from packagetest t where package_ID=@Package_ID

推荐答案

用作 use as [System.Data.Linq.Mapping.Function(Name = "[TRNS].[Get_PRGoods]")] public System.Data.Linq.ISingleResult<PRGood> GetPRGoodsDetails(int PickupID) { System.Data.Linq.IExecuteResult result = this.ExecuteMethodCall(this, ((System.Reflection.MethodInfo)(System.Reflection.MethodInfo.GetCurrentMethod())), PickupID); return ((System.Data.Linq.ISingleResult<PRGood>)(result.ReturnValue)); }

hiii,请参阅本文 http: //weblogs.asp/scottgu/archive/2007/08/16/linq-to-sql-part-6-retrieving-data-using-stored-procedures.aspx [ ^ ] hiii,refer this article weblogs.asp/scottgu/archive/2007/08/16/linq-to-sql-part-6-retrieving-data-using-stored-procedures.aspx[^]

更多推荐

将存储过程与linq一起使用到SQL

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

发布评论

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

>www.elefans.com

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