473,403 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Assigning Reportviewer datasource at runtime?

I have a winform with a reportviewer object on it. I'm trying to get
data from a datatable to display on the report. myDatatTable is
created and filled at runtime. I don't get any errors but only the
literal below displays in the report.

Microsoft.Reporting.WinForms.ReportDataSource rds = new
Microsoft.Reporting.WinForms.ReportDataSource();
rds.Name = myDataTable.TableName;
rds.Value = myDataTable;
reportViewer1.LocalReport.ReportPath = "Report1.rdlc";
reportViewer1.LocalReport.DataSources.Clear();
reportViewer1.LocalReport.DataSources.Add(rds);
reportViewer1.RefreshReport();

In the report designer, I have a textbox with this in it

Fields!PersonCode.Value

I've also tried

=First(Fields!PersonCode.Value)

Any suggestions on what I'm doing wrong?

Thanks,
Brett

Nov 21 '06 #1
1 36320
first you should try changing the line:
reportViewer1.LocalReport.DataSources.Add(rds);

for something like this:
reportViewer1.LocalReport.DataSources.Add(new
ReportDataSource("dsDetallado_TBARCHIVO", dtTbl));

where "dsDetallado_TBARCHIVO" is the original name of the datasource you
use to design the report. The "dtTbl" is the new datatable that contains
the data.

I hope this helps.


*** Sent via Developersdex http://www.developersdex.com ***
Apr 25 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Henry Seymour | last post by:
I need to read data from an SQLServer , massage it, and output it to a temporary dataset for ReportViewer/Chart to use. a. The incoming and outgoing datasets do not look alike. Therefore, I...
0
by: bill | last post by:
The design time Connection string for my table adapters don't change/can't be set during run time. I have a business layer class project and added a typed dataset. In VS2005 the Table adapter...
3
by: Charles Law | last post by:
This is driving me mad. Can someone please put me out of my misery? I have a DataSet which I wish to use as the data source for a grid control (it is actually an Infragistics grid). When I assign...
1
by: steve | last post by:
Hi All I need help on how to manipulate the data returned from the database for displaying in the new reportviewer at runtime So far I have an rdlc file with a dataset, binding source and...
0
by: Mark | last post by:
Hello, How do I change the report that is displayed in a reportviewer control programmatically? Do I also have to change the reportviewer datasource? Thanks in advance!
0
by: Rich | last post by:
Hello, I started using the Reportviewer control (very nice) for generating Reporting Services type reports in my VB2005 app. I have been experimenting using a designer Reportviewer control from...
1
by: Rich | last post by:
Hello, I need to print a report from the VS2005 Reportviewer control. My problem is that I need to print to a tractor feed (dotmatix like) printer that is not the default printer - for printing...
0
by: billygotee | last post by:
Hi, I posted an issue previously that was entirely accurate. I have a master report called "MasterReport.rdlc" and a subreport called "Subreport.rdlc". MasterReport.rdlc has a single subreport...
10
by: AG | last post by:
I am trying to use a ReportViewer control in a VS 2005 web application project (not Website project). When I try to create a new report (local), I can't seem to find any method to create a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.