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 182797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:00:11+00:00 2026-05-11T15:00:11+00:00

I don’t expect to get a great response from this, so if you have

  • 0

I don’t expect to get a great response from this, so if you have had experience in this any contribution would be appreciated.

I am trying to use the Visual Studio Report Designer with a Linq to SQL datasource, I have no experience of using the Visual Studio Report Designer.

If I go through the wizard and use an object datasource I can get a simple report listing a single entity type (i.e. sql table) easily enough. My questions is how do I get the report to accept complex Linq queries with Joins, Sums etc. that have an anonymous return type. If I try this at the moment I get a compile time error from the report designer when trying to use the dot notation or aliased names to get to the fields that I need to reference in the results of the query. I think this is because the designer is expecting the same type as was specified in the wizard…

The error is:-

Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope.

Maybe I’m better off using DataSets?

  • 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. 2026-05-11T15:00:11+00:00Added an answer on May 11, 2026 at 3:00 pm

    Write a simple class containing all the properties your report will need (call it eg. MyData). Use simple .NET types for each property: string, int, etc

    Write another class with a GetXxx method, which returns IEnumerable<MyData>. This Get method should return the results of your Linq query. You can do a .ToList() before returning, to get an in-memory list, allowing you to close the connection before returning.

    Compile.

    Now open your report designer (in same solution), and you should see MyData listed in your Data Sources window, with the Get method which you wrote.

    If you drag the fields from this data source onto your report designer, and then refer to this report from a new ReportViewer control, the ObjectDatasource will be automatically created and linked up for you.

    Hope that helps!

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

Sidebar

Related Questions

I don't have any experience in updating a Rails app and when I google
(Don't know if this is strictly on-topic, but I don't see any better Stack
Don't know how to explain it better but i'm trying to get a response
Don't overthink this - there's a very commonly used term and I ... have
Don't have much to say, just can get into the event handler. XAML: <Grid>
Don't think my virtualhost is working correctly. This is what I have inside of
I don't know why this double json response are not successful: [{first_content:content,...}][{second_content:content,...}] So i
Don't know if this has been answered before. Have custom routes to users. If
I don't have much PHP experience and I want to know how to best
Don't know why but I can't find a solution to this. I have 3

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.