Results 1 to 2 of 2

Thread: How to write LINQ query for like, in, not in

  1. #1

    Thread Starter
    Addicted Member mynameishide's Avatar
    Join Date
    Apr 2010
    Posts
    136

    Question How to write LINQ query for like, in, not in

    How to write linq which produce below sql syntax.
    HTML Code:
    1.select * from tbl1 where tbl1.id in (select id from tbl2)
    2.select * from tbl1 where tbl1.in like (1,2,3,4)
    Thank you.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: How to write LINQ query for like, in, not in

    Well, first off the like as you have it doesn't make sense, even in SQL and isn't likely to work.

    When I need something as general as this, I usually look up 101 LINQ Examples.
    https://code.msdn.microsoft.com/101-...mples-3fb9811b

    it's got a nice cross section of different types of queries you can do with LINQ


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width