Results 1 to 9 of 9

Thread: [RESOLVED] ToList is not a member of "System.Data.EnumerableRowCollection"

  1. #1

    Thread Starter
    Fanatic Member aNubies's Avatar
    Join Date
    Aug 2008
    Posts
    558

    Resolved [RESOLVED] ToList is not a member of "System.Data.EnumerableRowCollection"

    Help here I accidentally pull the power cable and my computer shutdown. After re-opening my project all my LINQ queries turned into this kind of error:

    Code:
    ToList is not a member of "System.Data.EnumerableRowCollection"
    How to fix this?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: ToList is not a member of "System.Data.EnumerableRowCollection"

    Logically, if you want us to help you with a broken LINQ query then you should show us the query.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member aNubies's Avatar
    Join Date
    Aug 2008
    Posts
    558

    Re: ToList is not a member of "System.Data.EnumerableRowCollection"

    @JM: I think i would not call it broken query, cause it was running fine not until the computer accidentally shutdown, and when re-opening it that error showed up.

  4. #4
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: ToList is not a member of "System.Data.EnumerableRowCollection"

    Either way, unless you show us the code, we are guessing.

  5. #5

    Thread Starter
    Fanatic Member aNubies's Avatar
    Join Date
    Aug 2008
    Posts
    558

    Re: ToList is not a member of "System.Data.EnumerableRowCollection"

    Alright here's the code :

    Code:
            Dim listItem = (From rowItem In newDatatable.AsEnumerable() _
                                Select New With {.SIGN_NAME = rowItem.Field(Of String)("SIGN_NAME")}).ToList

  6. #6
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: ToList is not a member of "System.Data.EnumerableRowCollection"

    Your linq statement is returning a different type from mine, it should be returning a EnumerableRowCollection(Of TRow) which has the extension .ToList that you were using, but as your message it is only returning its base class.

    Did you recreate the project file or anything? Change any of the Option infer/strict options etc, or maybe even the framework type?

  7. #7
    PowerPoster
    Join Date
    Mar 2002
    Location
    UK
    Posts
    4,780

    Re: ToList is not a member of "System.Data.EnumerableRowCollection"

    newDatatable.AsEnumerable was added in 3.5, so assume you are using that or 4.0? What type is newDatatable declared as?

  8. #8
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: ToList is not a member of "System.Data.EnumerableRowCollection"

    It sounds like maybe you've lost a library reference or, more likely, a namespace import. Try creating a new project in which that code works, then confirm that you're old project has all the same references and imports.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  9. #9

    Thread Starter
    Fanatic Member aNubies's Avatar
    Join Date
    Aug 2008
    Posts
    558

    Re: ToList is not a member of "System.Data.EnumerableRowCollection"

    @JM: Yeah I found out that I lost some reference and also namespace import thanks to all replies.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width