Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. LINQ
  4. How to write Linq for this T-SQL

How to write Linq for this T-SQL

Scheduled Pinned Locked Moved LINQ
csharpdatabaselinqtutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jason_mf
    wrote on last edited by
    #1

    select * from A where id in (1,2,3,4,5,6,7,10,15,18,20,25,30,40,45,50,) how to write Linq

    S 1 Reply Last reply
    0
    • J jason_mf

      select * from A where id in (1,2,3,4,5,6,7,10,15,18,20,25,30,40,45,50,) how to write Linq

      S Offline
      S Offline
      Syed Mehroz Alam
      wrote on last edited by
      #2

      You need to use the Contains operator;

      var list = new List { 1,2,3,.... };
      var query = dc.Table.Where( t=>list.Contains(t.ID) );

      Syed Mehroz Alam My Blog | My Articles
      Computers are incredibly fast, accurate, and stupid; humans are incredibly slow, inaccurate and brilliant; together they are powerful beyond imagination. - Albert Einstein

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups