Click here to Skip to main content
12,635,398 members (24,510 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: SQL LINQ
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

Posted 9-Feb-12 20:03pm
Updated 9-Feb-12 20:31pm
v3
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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));
       }
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161208.2 | Last Updated 20 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100