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. where clause in LINQ

where clause in LINQ

Scheduled Pinned Locked Moved LINQ
csharpdatabaselinq
4 Posts 4 Posters 3 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.
  • N Offline
    N Offline
    Nilish
    wrote on last edited by
    #1

    how should i use the where clause in the query. I have the followuing query Dim obj As New InvestorManagementDataContext() Dim XElement As XElement ' Dim a = (From p In obj.a Select p.Investor_Name(), p.InvestorID) XElement = New XElement("GetPrices", From f In obj.a Select New XElement("Title", _ New XElement("Name", f.Name), _ New XElement("ID", f.ID))) i want to filter the query with the attribute name in two ways. where name = "abc" where name like "%" & "abc" & "%"

    G B 2 Replies Last reply
    0
    • N Nilish

      how should i use the where clause in the query. I have the followuing query Dim obj As New InvestorManagementDataContext() Dim XElement As XElement ' Dim a = (From p In obj.a Select p.Investor_Name(), p.InvestorID) XElement = New XElement("GetPrices", From f In obj.a Select New XElement("Title", _ New XElement("Name", f.Name), _ New XElement("ID", f.ID))) i want to filter the query with the attribute name in two ways. where name = "abc" where name like "%" & "abc" & "%"

      G Offline
      G Offline
      Gayani Devapriya
      wrote on last edited by
      #2

      Hi, from p in obj.a where p.name == "abc" || p.name.Contains("abc") Select p.name Thx, Gayani

      J 1 Reply Last reply
      0
      • G Gayani Devapriya

        Hi, from p in obj.a where p.name == "abc" || p.name.Contains("abc") Select p.name Thx, Gayani

        J Offline
        J Offline
        Judah Gabriel Himango
        wrote on last edited by
        #3

        Technically, you could just write where p.name.Contains("abc") .

        1 Reply Last reply
        0
        • N Nilish

          how should i use the where clause in the query. I have the followuing query Dim obj As New InvestorManagementDataContext() Dim XElement As XElement ' Dim a = (From p In obj.a Select p.Investor_Name(), p.InvestorID) XElement = New XElement("GetPrices", From f In obj.a Select New XElement("Title", _ New XElement("Name", f.Name), _ New XElement("ID", f.ID))) i want to filter the query with the attribute name in two ways. where name = "abc" where name like "%" & "abc" & "%"

          B Offline
          B Offline
          balaji t
          wrote on last edited by
          #4

          hi im not sure whether contains will b ok.To be specific u can use this for like type of queries from a in db.client where SqlMethods.Like(a.Client_Name, "%abc%") select ... sqlmethods have other methods like datwediffday,datediffsecond,datediffhour etc prior writing this include this namespace using System.Data.Linq.SqlClient;

          T.Balaji

          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