Skip to content

LINQ

LINQ (all flavours)

This category can be followed from the open social web via the handle linq-e04cf296@forum.codeproject.com

783 Topics 2.8k Posts
  • Include() Question

    question database help tutorial
    2
    0 Votes
    2 Posts
    5 Views
    V
    Just add StreetSuffix in the Property include return this.ObjectContext.Observations.Include("Property.StreetSuffix") Also check this blog post for a Include using lamba expression: Improving Objectquery-lt-t-gt-include[^] Be careful with Include as the resulting query can become quite complex. Sometime it can be more efficient to do multiple simple query. Vince Remember the dead, fight for the living
  • cutom query

    help css database
    6
    0 Votes
    6 Posts
    14 Views
    P
    thank you dasblinkenlight for your suggestion, the problem is that I have a table with 7 columns but just want to display only 4 of them
  • LINQ to Entities 1 to many query

    database help csharp linq question
    3
    0 Votes
    3 Posts
    9 Views
    P
    That's excellent thanks. The change to LINQ is a bit of a paradigm shift and I certainly need more practise! Thanks again for your help. Paul
  • Convert Linq Query to SQL Server Query

    csharp database learning css asp-net
    7
    0 Votes
    7 Posts
    16 Views
    S
    Thank all for your help, I guess there is to much in LINQ to learn since many objects are related to each other. Regarding my question, I solved using this way. Dim context As New dxAdventureWorksDataContext Dim query\_product As IQueryable(of Product) = From p In context.Products Select p ' build dynamic linq query\_product = query\_product.Where(Function(f) f.ProductID > 1000) query\_product = query\_product.Where(Function(f) f.Name.Contains("A")) ' create another query for required field, if you want all fields, you may omit this line Dim query\_product\_field = From pp In query\_product Select pp.ProductNumber,pp.Name ' get sql query Dim cmd As SqlCommand = TryCast(context.GetCommand(query\_product\_field), SqlCommand) Debug.Print(cmd.CommandText) the output is : SELECT [t0].[ProductNumber], [t0].[Name] FROM [Production].[Product] AS [t0] WHERE ([t0].[Name] LIKE @p0) AND ([t0].[ProductID] > @p1)
  • Filter list 1 based on list 2

    csharp database linq help question
    2
    0 Votes
    2 Posts
    7 Views
    N
    Without knowing the specific columns involved this is just a guess but should give you an idea from m in managers join e on e.name equals m.name where m.type neq "contractor" select m I know the language. I've read a book. - _Madmatt
  • 0 Votes
    2 Posts
    6 Views
    H
    var data=from p in objectContext.person select new person{ firstname=p.firstname};
  • How to convert String to LINQ query?

    linq tutorial csharp database question
    2
    0 Votes
    2 Posts
    6 Views
    N
    IQueryAble x = (from p in where p.id select new{ p.PropertyNameHere }).AsQueryAble(); ============================================ The grass is always greener on the other side of the fence
  • 0 Votes
    2 Posts
    6 Views
    N
    It's your application. If you code it to use Oracle and SQL Server, then it will work with both. You won't, of course, be able to use the same entity data context classes because they will be different database engines. I know the language. I've read a book. - _Madmatt
  • Linq solution to union two select statements

    csharp database linq tools tutorial
    2
    0 Votes
    2 Posts
    6 Views
    P
    Very nice, but you should probably add this as a tip or trick. Forgive your enemies - it messes with their heads My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility
  • ROW_NUMBER Conversion

    csharp linq help
    2
    0 Votes
    2 Posts
    6 Views
    B
    Customers.AsEnumerable().OrderBy(obj => obj.LastName).Select((obj, index) => new {Index = i++, obj}); Or something like that...
  • tutorial for LINQ

    csharp linq help tutorial
    3
    0 Votes
    3 Posts
    9 Views
    M
    thanks Timothy http://windowsclient.net/learn/videos_wpf.aspx[^] its about WPF & LINQ ! Thanks for http://www.codeproject.com/script/Membership/View.aspx?mid=7467577[^] modified on Monday, March 28, 2011 3:18 PM
  • DBML - Configure behavior select.

    database announcement
    1
    0 Votes
    1 Posts
    3 Views
    No one has replied
  • Waht is serialization c sharp

    csharp json
    3
    0 Votes
    3 Posts
    8 Views
    L
    Serialization is the ability to store a class / object in a string value or file. Sofar the best type of serialization I experienced is XML serialization for two reasons: 1)Its way less buggy 2)It gives you the ability to read your data in a readable format . Now what you need to understand about serialization is it stored the values of public properties and variables. it in no way will store your even hookups done internally or extenally. With linq if you wish to store a LINQ object in serialized form I recommend that you remove all relations it has because in most cases the relation will cause a continuous circular reference in its public property's (parent of child of parent of child of ect). Also keep in mind certain linq objects cant be stored like the data context. and that changign a linq object after loading it back from file and hitting submit changes wont do anything becuase the context with which that object was created has long passed. Chona1171 Web Developer (C#), Silverlight
  • 0 Votes
    2 Posts
    6 Views
    V
    In C#, List Records = (get list...) List MatchParams = (from er in Records from p in er.Parametrics where er.UpdateDate < DateToMatch select p).ToList(); OR List MatchParams2 = Records.Where(er => er.UpdateDate < DateToMatch).SelectMany(er => er.Parametrics).ToList(); Vince Remember the dead, fight for the living
  • 0 Votes
    5 Posts
    9 Views
    S
    :)
  • Generic linq contains

    csharp linq tutorial question
    3
    0 Votes
    3 Posts
    8 Views
    U
    Thanks, i will try, apologizes for the delay but i dont have internet until today thanks for you time.
  • 0 Votes
    4 Posts
    9 Views
    D
    OK, thanks for explanation!
  • 0 Votes
    6 Posts
    12 Views
    P
    zommarin wrote: .SingleOrDefault(); is good when you want a null when nothis is found Not quite. If no element is found, and it's a none nullable type then the default is returned, e.g. an int would return 0. I have CDO, it's OCD with the letters in the right order; just as they ruddy well should be Forgive your enemies - it messes with their heads My blog | My articles | MoXAML PowerToys | Onyx
  • Updating list(of t) using LINQ

    question csharp linq json tutorial
    8
    0 Votes
    8 Posts
    19 Views
    N
    You're welcome I know the language. I've read a book. - _Madmatt
  • 0 Votes
    4 Posts
    9 Views
    M
    I think the other answer is slightly wrong for your needs, try something like... if(DB.products_tags.Count(t => t.Product.ID == productID && t.Tag.TagName == tagName) == 0) { //No conflicting tag found so can insert the new tag } Life goes very fast. Tomorrow, today is already yesterday.