本文介绍了将存储过程与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
发布评论