where clause in LINQ
-
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" & "%"
-
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" & "%"
-
Technically, you could just write
where p.name.Contains("abc")
. -
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" & "%"
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