Visual Studio Development Bookmark and Share   
 index > Visual Studio Report Controls > Runtime datasource - Reportviewer control
 

Runtime datasource - Reportviewer control

Hi,
I have an application that on runtime generate a datatable with a list of
persone, with name, andress, etc..
I want to add the possibility to print the list of all the person, and I want
to use ReportViewer. But I have this problem:
I create with the designer my report, without set and datasource. Then from
code:

SqlDataAdapter Read = new SqlDataAdapter("SELECT * FROM People",
Connection);
DataTable PeopleTable = new DataTable();
Read.Fill(PeopleTable);
reportViewer1.LocalReport.DataSources.Add(new
Microsoft.Reporting.WinForms.ReportDataSource("People", PeopleTable));
reportViewer1.LocalReport.ReportEmbeddedResource =

But when I test my program I get this error:

The Value expression for the textbox 'textbox1' refers to
the field 'Name'. Report item expressions can only refer to fields within
the current data set scope or, if inside an aggregate, the specified
data set scope.

My question is: It is possible to use a Report.rdcl create with the
designer, with a runtime dataset?
In a textbox of the Report.rdcl wath value is to set? Now I used
=Fields!Name.Value

Thanks
  • Moved byAland LiMSFTThursday, October 15, 2009 6:36 AMIncorrect forum. (From:Windows Forms General)
  •  
kishorkk  Tuesday, October 13, 2009 6:31 PM
Hi kishorkk,

I have moved the thread from the "Windows Forms General" forum to the "Visual Studio Report Controls" forum since the issue is about report controls. There are more report controls experts in the "Visual Studio Report Controls" forum.

Regards,
Aland Li
Please mark the replies as answers if they help and unmark if they don't. This can be beneficial to other community members reading the thread.
Aland Li  Thursday, October 15, 2009 6:40 AM

You can use google to search for other answers

Custom Search

More Threads

• How to Pass a Variable to an Expression in the ReportViewer
• Hiding zero values in table cells
• ReportViewer Interactive Page Size not matching .RDL Interactive Page Size in Report Designer
• Print Data on Pre-Printed Certificate
• Report Output not correct...
• Rookie report control questions
• Strange line on top of a chart
• What's wrong with my report?
• Report filtering null date values
• WindowsForms ReportViewer Control - Memory access violation when printing