none
linq to sql RRS feed

  • Question

  • Hi Guys,

    I am trying to translate the inserted linq script to sql but I am not sure of how to deal with the last line (

    @p__linq__0=1,@p__linq__1=141

    )


    please help!!


    exec sp_executesql N'SELECT TOP (1) 
    [Extent1].[id] AS [id], 
    [Extent1].[userId] AS [userId], 
    [Extent1].[fkId] AS [fkId], 
    [Extent1].[type] AS [type], 
    [Extent1].[flags] AS [flags], 
    [Extent1].[notes] AS [notes], 
    [Extent1].[dt] AS [dt], 
    [Extent1].[mag] AS [mag], 
    [Extent1].[datasetId] AS [datasetId], 
    [Extent2].[id] AS [id1], 
    [Extent2].[organisationId] AS [organisationId], 
    [Extent2].[extId] AS [extId], 
    [Extent2].[login] AS [login], 
    [Extent2].[password] AS [password], 
    [Extent2].[flags] AS [flags1], 
    [Extent2].[forenames] AS [forenames], 
    [Extent2].[surname] AS [surname], 
    [Extent2].[dob] AS [dob], 
    [Extent2].[email] AS [email], 
    [Extent2].[mobileTel] AS [mobileTel], 
    [Extent2].[address] AS [address], 
    [Extent2].[tel] AS [tel], 
    [Extent2].[personalemail] AS [personalemail], 
    [Extent2].[d1] AS [d1], 
    [Extent2].[d2] AS [d2], 
    [Extent2].[uln] AS [uln], 
    [Extent2].[aimHigher] AS [aimHigher], 
    [Extent2].[als] AS [als], 
    [Extent2].[initAssess] AS [initAssess], 
    [Extent2].[mtg] AS [mtg], 
    [Extent2].[collegeId] AS [collegeId], 
    [Extent2].[universityId] AS [universityId]
    FROM  [dbo].[UserAssociations] AS [Extent1]
    INNER JOIN [dbo].[Users] AS [Extent2] ON [Extent1].[userId] = [Extent2].[id]
    WHERE ([Extent1].[datasetId] = @p__linq__0) AND (5 = [Extent1].[type]) AND ([Extent1].[fkId] = @p__linq__1) AND ((([Extent1].[flags]) & (2)) > 0) AND (0 = (([Extent1].[flags]) & (1)))',N'@p__linq__0 int,@p__linq__1 int',@p__linq__0=1,@p__linq__1=141


    Sunday, November 25, 2012 2:09 AM

All replies

  • Hi Guys,

    I got 15 views on this thread but no replies...... didn't i ask properly

    Sunday, November 25, 2012 9:18 AM
  • Hi,

    where is your LINQ query ?

    Monday, November 26, 2012 2:00 PM
  • Hi,

    Could you please let me know why you want to translate linq yourself?

    Also, the code you provide is the sql script already.

    Monday, November 26, 2012 2:02 PM
  •  var q1 = from sr in em.SubReviews
                         join c in em.Courses on sr.courseId equals c.id
                         where sr.datasetId == datasetId
                         && sr.userId == studentId
                         && (sr.flags & (int)SR_Flags.DELETED) == 0
                         && (c.flags & (int)Course_Flags.DELETED) == 0
                         orderby c.code, sr.dt descending
                         select new { sr, c };
    Monday, November 26, 2012 2:05 PM
  • Hi SirReadAlot,

    I am confused. Do you want to translate Linq to sql? Or translate sql to linq?

    Have a nice day.


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, November 28, 2012 7:24 AM
  •  var q1 = from sr in em.SubReviews
                         join c in em.Courses on sr.courseId equals c.id
                         where sr.datasetId == datasetId
                         && sr.userId == studentId
                         && (sr.flags & (int)SR_Flags.DELETED) == 0
                         && (c.flags & (int)Course_Flags.DELETED) == 0
                         orderby c.code, sr.dt descending
                         select new { sr, c };

    Hi,

    and where is @p__linq__0=1,@p__linq__1=141 ?

    Please don't be in hurry . Before posting your question kindly review it carefully that whether it makes any sense or not!


    One good question is equivalent to ten best answers.



    • Edited by Shyam Kr Wednesday, November 28, 2012 8:36 AM
    Wednesday, November 28, 2012 8:34 AM
  • For translating queries from LINQ to SQL you'd better use LINQPAD rather doing it yourself

    http://www.linqpad.net/


    Please Mark as Reply and Vote as Helpful if I helped.

    Also please visit my blog http://msguy.net/


    Wednesday, November 28, 2012 4:12 PM