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. Linq Query fails after first

Linq Query fails after first

Scheduled Pinned Locked Moved LINQ
questioncsharpdatabaselinqsales
3 Posts 3 Posters 23 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.
  • U Offline
    U Offline
    User 13592306
    wrote on last edited by
    #1

    Hello: I simply want to write multiple queries to assign information.

    var q =
    from a1 in dt_Jobs.AsEnumerable()
    orderby a1.Field("Customer")
    select a1.Field("Customer");
    var lstCustomer = q.Distinct().ToList();
    cboCustomer.DataSource = lstCustomer;

    q =
    from a1 in dt_Jobs.AsEnumerable()
    orderby a1.Field("City")
    select a1.Field("City");
    var lstCity = q.Distinct().ToList();
    cboCity.DataSource = lstCity;

    The first block works, the second fails. How can I achieve something like this?? Thanks!

    Richard DeemingR L 2 Replies Last reply
    0
    • U User 13592306

      Hello: I simply want to write multiple queries to assign information.

      var q =
      from a1 in dt_Jobs.AsEnumerable()
      orderby a1.Field("Customer")
      select a1.Field("Customer");
      var lstCustomer = q.Distinct().ToList();
      cboCustomer.DataSource = lstCustomer;

      q =
      from a1 in dt_Jobs.AsEnumerable()
      orderby a1.Field("City")
      select a1.Field("City");
      var lstCity = q.Distinct().ToList();
      cboCity.DataSource = lstCity;

      The first block works, the second fails. How can I achieve something like this?? Thanks!

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      You have already posted this in the C# forum: Linq Query Limitations, more than one query fails - C# Discussion Boards[^]


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      • U User 13592306

        Hello: I simply want to write multiple queries to assign information.

        var q =
        from a1 in dt_Jobs.AsEnumerable()
        orderby a1.Field("Customer")
        select a1.Field("Customer");
        var lstCustomer = q.Distinct().ToList();
        cboCustomer.DataSource = lstCustomer;

        q =
        from a1 in dt_Jobs.AsEnumerable()
        orderby a1.Field("City")
        select a1.Field("City");
        var lstCity = q.Distinct().ToList();
        cboCity.DataSource = lstCity;

        The first block works, the second fails. How can I achieve something like this?? Thanks!

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        What do you mean by it fail? It should have to give you issue/error but you did not mentioned that.

        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