Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4616828
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:02:18+00:00 2026-05-22T02:02:18+00:00

I am using a LINQ statement that selects from various tables information I need

  • 0

I am using a LINQ statement that selects from various tables information I need to fill some Post / Post Comment style records. I’m getting a funny exception saying that the object must implement IConvertible when I try to iterate the record set. The funny part about it is that it seems to only occur when the anonymous type I’m using to hold the data contains more than 2 generic collections.

//select friend timeline posts posts
var pquery = from friend in fquery
    join post in db.game_timeline on friend.id equals post.user_id
    //join user in db.users on post.friend_id equals user.id into userGroup
    //join game in db.games on post.game_id equals game.game_id into gameGroup
    select new
    {
        Friend = friend,
        Post = post,

        Game = from game in db.games
          where game.game_id == post.game_id
          select game,

        Recipient = from user in db.users
          where user.id == post.user_id
          select user,

        Comments = from comment in db.timeline_comments
          where comment.post_id == post.id
          join users in db.users on comment.user_id equals users.id
          select new { User = users, Comment = comment }
    };

(Note: I am using MYSQL Connector/Net so things like Take and FirstOrDefault and things like that are not supported within the LINQ statements themselves, I have opted to use those methods during iteration as it does not raise an exception there)

The problem is, when all 3 fields (Game, Recipient, and Comments) are present. I get the exception “Object must implement IConvertible”. BUT if I remove ANY one of the 3 field assignments (doesn’t matter which one), it works just fine. Anybody know what’s going on here?

Thanks in advance!

Ryan.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T02:02:19+00:00Added an answer on May 22, 2026 at 2:02 am

    This is a guess, but I think your anonymous type might be attempting to duck-type to an enum when you’ve got more than two queries. If that’s happening, then you’ll get this complaint about not implementing IConvertible, as enum implements IConvertible, and your anonymous type (now derrived from enum) does not implement the interface.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to replicate a T-SQL statement that has an inner select, using LINQ:
I need to gather Distinct Id's from a particular table using LINQ. The catch
I'm writing a Function that pulls Records from a DataBase using LINQ to get
I am using LINQ to access my database tables. Some of the tables might
I am using LINQ-to-Entities and need to populate a ListView using a select statement
I have an insert statement that was deadlocking using linq. So I placed it
Here's a LINQ statement that I am trying to execute var usersQuery = from
I have a linq union statement that has been giving me some trouble and
I have following LINQ statement and I want to rewrite it using extension methods.
Using Linq To XML, how can I get the space_id value (720) from the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.