none
Error with LINQ RRS feed

  • General discussion

  • I have a datatable (from SQL Express) and I can not run any LINQ code on it. The datatable code is auto-generated.

    System.Core is referenced
    System.LINQ in used

    But when I try any LINQ command it tells me 
     ... does not contain a definition for 'SingleOrDefault' and no extension method 'SingleOrDefault' accepting a first argument of type '...DataTable' could be found (are you missing a using directive or an assembly reference?)

    I gave up


    • Moved by eryang Monday, November 30, 2009 2:16 AM wrong forum (From:.NET Base Class Library)
    • Changed type Yichun_Feng Thursday, December 3, 2009 6:15 AM
    Friday, November 27, 2009 1:47 PM

All replies

  • Where did your generated code come from?  Linq to SQL classes?  Link to Entities classes?

    If it's truly not supported, then you can still always fall back to client-side query.  .ToArray() your results and use Linq to objects.
    Friday, November 27, 2009 2:15 PM
  • well, it comes from standard generated DataSet code. And you will laugh but yesterday it compiled just fine. I stopped on successful compilation to continue today. And today it does not compile any more. Nothing was changed.
    Friday, November 27, 2009 2:21 PM
  • dont ask me why and how but deleting data source and creating a new one helped. looks like a typical MS error
    Friday, November 27, 2009 2:41 PM
  • Hi,
    I moved this thread to LINQ To SQL forum for better support.

    Thanks,
    Eric
    Please remember to mark helpful replies as answers and unmark them if they provide no help.
    Monday, November 30, 2009 2:15 AM
  • Hi sn75,

     

    Are you working with LINQ to Dataset or other type?

    If it is LINQ to entity, you have to add reference of System.Data.Entity.dll.

     

    Is your System.Core's version 3.5?

     

    Please update with more details about your problem and we will have a further discussion.

     

     

    Best Regards

    Yichun Feng

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Tuesday, December 1, 2009 7:36 AM
  • Hi sn,

     

    We are changing the issue type to “Comment” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.

     

     

    Best Regards

    Yichun Feng


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, December 3, 2009 6:15 AM