Click here to Skip to main content
16,022,538 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
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.

SQL
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
Posted
Updated 9-Feb-12 19:31pm
v3

use as

XML
[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));
       }
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900