what you're doing looks pretty much correct. i do exactly that (this is vb):
rptviewer.localreport.reportpath = <filepath> rptviewer.localreport.datasources.clear() rptviewer.localreport.datasources.add(new reportdatasource("<data_source_name_in_report>", <linq_query_result>)) rptviewer.setdisplaymode(displaymode.printlayout)
the one bit you need to check is that you are matching the datasource name that is in the report correctly. you can check this by opening the report in a text editor and looking in the datasources element.
the other thing from memory, and i've not used this in about a year so i might be wrong, i've got a niggling feeling you have to call either
rptviewer.setdisplaymode() to force it to render.
take a look at this website for plenty of info on the reportviewer control:
- Use a linq query as microsoft local report Data Source (WinForms)
- LINQ to SQL: Complicated query with aggregate data for a report from multiple tables for an ordering system
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- Using LINQ query result for data source for GridControl c#
- How do i use linq as datasource for a Microsoft report
- Can I use a LINQ IEnumerable result as the data source for a Gtk.TreeView?
- Linq query null check in data source
- Can I Use The Same Linq Code to Query for Different Conditions?
- How to use Linq Aggregate Query to print line sequence number alongwith some data from the List<string>?
- c# Linq or code to extract groups from a single list of source data
- How to use linq query on list to find last data by name and number c#?
- how to fetch data from database using linq query for relationship 1:N and N:N (between 3 entity) in asp.net mvc EF code first?
- How to assign LINQ Query to a variable and then use it later in the code
- LINQ query code for complex merging of data
- Use dynamic linq or sql query in report generator
- How to use Linq Query in Object Data Source?
- How to use LINQ in C# to query windows local user accounts
- Is there way to use Distinct in LINQ query syntax?
- Query Microsoft Access MDB Database using LINQ and C#
- Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains() operator
- How to use index/position with Where in LINQ query language?
- LINQ To SQL exception: Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains operator
- LINQ query — Data aggregation (group adjacent)
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- How/Can I use linq to xml to query huge xml files with reasonable memory consumption?
- Linq error generic parameter or the query must use a nullable type
- Query data using "Contains" keyword in Dynamic Linq in C#
- Building a LINQ query programmatically without local variables tricking me
- How to I use TryParse in a linq query of xml data?
- Use LINQ to group data from DataTable
More Query from same tag
- Using LINQ to read key value pair from configuration file
- VB Linq Group Join query FAILS to order the results in descending order
- How to use Dapper with Linq
- Updating an item using LINQ, not working
- How to count group of records using LINQ Query?
- LINQ to Entities does not recognize the method 'System.String StringConvert(System.Nullable`1[System.Double])
- Filtering include items in LINQ and Entity Framework
- Search in dictionary of dictionaries
- Trying to read xml file with LINQ
- Linq linq-to-entities add join if condition is met
- Ordering list by many conditions using Linq
- Complex Subtotals needed for in house report
- How to filter columns on child table in a one to many relationship
- Issue with Object returned when using Linq Where clause
- LINQ : Nesting this into a single query
- Using Linq to pull from IEnumerable<XElement> and store in data table
- Linq2SQL "Local sequence cannot be used in LINQ to SQL" error
- LINQ to NHibernate expressions on List<>
- C# List<List<string>> filtering with LinQ
- Using a Linq query to select objects where any value of a property matches values from a list
- Calling a method inside a Linq query
- Check is IEnumerable<T> has 5 or more matches
- Confused on Updating Table using DataGrid
- Empty namespace using Linq Xml
- LINQ | How do I get SUM without grouping?
- Concat two List<T>'s where a field value in each is equal
- Cannot implicitly convert type 'System.Linq.IQueryable<AnonymousType#6>' to 'decimal'
- Nullable int not working as expected in LINQ (C#)
- left join with group by and sum in linq to sql
- What Linq to Entities statement tells me if a particular child entity exists?