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. runtime error "invalidoperation exception" ?

runtime error "invalidoperation exception" ?

Scheduled Pinned Locked Moved LINQ
databasehelpcsharplinqquestion
3 Posts 3 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.
  • H Offline
    H Offline
    haseeb_saeed
    wrote on last edited by
    #1

    hi, I made the following linq to sql query and it seems to be working fine because the number of rows returned is exactly wat i wanted but now i can't retrieve my information from it... i am pasting the code below, with the error ,please provide help var d = (from a in db.GetTable() group a by a.name into g select new { g.Min().id,g.Min().name }); Dictionary<int,> dictMinIdPart = new Dictionary<int,>(); foreach (var c in d) { dictMinIdPart.Add(c.id, c.name); } Error: runtime error Invalidoperationexception Could not format node 'New' for execution as SQL thanx for ur help in advance best regards

    haseeb

    A 1 Reply Last reply
    0
    • H haseeb_saeed

      hi, I made the following linq to sql query and it seems to be working fine because the number of rows returned is exactly wat i wanted but now i can't retrieve my information from it... i am pasting the code below, with the error ,please provide help var d = (from a in db.GetTable() group a by a.name into g select new { g.Min().id,g.Min().name }); Dictionary<int,> dictMinIdPart = new Dictionary<int,>(); foreach (var c in d) { dictMinIdPart.Add(c.id, c.name); } Error: runtime error Invalidoperationexception Could not format node 'New' for execution as SQL thanx for ur help in advance best regards

      haseeb

      A Offline
      A Offline
      Andreas X
      wrote on last edited by
      #2

      Hello! the group g has the properties Key and Group. The Key is name, since you grouped by name. The group is a collection of all items with the same name. What are you trying to accomplish with teh query?

      Andreas Johansson
      IT Professional at Office IT Partner i Norrbotten Sweden
      What we don't know. We learn.
      What you don't know. We teach

      M 1 Reply Last reply
      0
      • A Andreas X

        Hello! the group g has the properties Key and Group. The Key is name, since you grouped by name. The group is a collection of all items with the same name. What are you trying to accomplish with teh query?

        Andreas Johansson
        IT Professional at Office IT Partner i Norrbotten Sweden
        What we don't know. We learn.
        What you don't know. We teach

        M Offline
        M Offline
        mark_me
        wrote on last edited by
        #3

        hi , thanx for ur help... well actually, i was working with a table that had a number of repeated values with different primary keys, i needed only distinct name and it's key so i thought of using a dictionary coz it sounded as if dictionary can store 2 values as opposed to lists... correct me if i am wrong with the idea of dictionary... Anyways , thanx alot and thanx for clarifying the key things...i was confused regarding keys... thanx

        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