| .NET DotNet Forum Index » ASP.NET Forum » Reporting Services Questions... |
|
Page 1 of 1 |
|
| Author |
Message |
| checkraiser at (no spam) community.nospam... |
Posted: Tue Oct 27, 2009 7:05 pm |
|
|
|
Guest
|
I am trying to take an .RDLC report that I created in Visual Studio 2008 and
bind it to a data table.
I created this code to pull the datatable--I am using an IBM Data Provider
for .NET, pulling the data from a System i/DB2 DB--which works. I've
confirmed that the data table is being created with data. Code below:
public DataTable getMyTransactionData()
{
DataTable dtCustomers = new DataTable("Trans");
try
{ using (iDB2Connection cnn = new
iDB2Connection(ConfigurationManager.ConnectionStrings["DB2ConnectionString"].ConnectionString) )
{
iDB2Command cmd = new iDB2Command();
cmd.Connection = cnn;
cmd.CommandText = "Select A.Offer, A.EventDate from
Event";
// open connection
cnn.Open();
//create data adapter and table.
iDB2DataAdapter da = new
iDB2DataAdapter(cmd.CommandText,cnn);
//fill datatable with data
da.Fill(dtCustomers);
// close connection
cnn.Close();
}
}
catch (iDB2Exception iex)
{
throw (iex);
}
catch (Exception ex)
{
throw(ex);
}
return dtCustomers;
}
I have a page with a ReportViewer which I bind the datatable to my RLDC file
in:
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DataTable dt;
MyTransaction objTRN = new MyTransaction();
dt = objTRN.getMyTransactionData();
ReportDataSource rds = new ReportDataSource();
rds.Name = "Trans";
rds.Value = dt;
ReportViewer1.LocalReport.DataSources.Add(rds);
//ReportViewer1.LocalReport.Refresh();
}
}
My questions:
1.) The report RLDC file already has a prior, old datasource specified in
it's XML with different field definitions. The old datasource is specified
at the table level as well as for the report's datasource. How do I change
this datasource designation for the datatable I'm querying above and remove
the existing datasource/field designations, as well as autogenerate all the
XML field definitions for my table in the RLDC?
2.) On another report, I noticed that ReportViewer1.LocalReport.Refresh();
was required in order to get the report to generate. Is it possible to stop
the report from auto loading on page load? |
|
|
| Back to top |
|
|
|
| Allen Chen [MSFT]... |
Posted: Sun Nov 01, 2009 9:05 pm |
|
|
|
Guest
|
Hi,
Quote: 1.) The report RLDC file already has a prior, old datasource specified in
it's XML with different field definitions. The old datasource is
specified
at the table level as well as for the report's datasource. How do I
change
this datasource designation for the datatable I'm querying above and
remove
the existing datasource/field designations, as well as autogenerate all
the
XML field definitions for my table in the RLDC?
Do you have any progress on this issue? If you have further questions
please don't hesitate to let me know. I'll do my best to follow up.
Regards,
Allen Chen
Microsoft Online Support |
|
|
| Back to top |
|
|
|
|