|
Subject:
|
subreports not working in ASP.NET
|
|
Posted By:
|
zothen123
|
Post Date:
|
12/14/2003 1:13:40 AM
|
Ok, people, here is what I am trying to do, but am not having any luck so far.
I have a stored proc called FI_DIR_COMPILE, this proc has 6 select statements in it. Each of the select statements are stored in a table in a dataset called dataset1.
The Data in each table has no relation to data in any other table. I have created a Crystal Report called test.rpt. I have added a strong typed report class to test.aspx for test.rpt called test1 I have a Crystal Report viewer called CrystalReport1 on test.aspx
In test.rpt I have 6 sub reports, on for each table. I have the complete dataset1 mapped into test. Each subreport only has 1 table from test in it.
The issue is I am getting no data in any of the subreports when I view the main report via test.aspx.
Below is the code I am using, Anyone have a clue ????
Begin c# code
public class WebForm7 : System.Web.UI.Page
{
protected System.Data.SqlClient.SqlConnection connection;
protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
protected SPROC.test test1 = null;
private void Page_Load(object sender, System.EventArgs e)
{
SqlCommand command = connection.CreateCommand();
command.CommandText="FI_DIR_COMPILE";
command.CommandType=CommandType.StoredProcedure;
fl_dir dataset1;
try
{
SqlDataAdapter adapter = new SqlDataAdapter(command);
dataset1 = new fl_dir();
adapter.Fill(dataset1, "FI_DIR_COMPILE");
adapter.Fill(dataset1, "NUO60");
adapter.Fill(dataset1, "NUOALL");
adapter.Fill(dataset1, "VEHCLASS");
adapter.Fill(dataset1, "fl_recap");
adapter.Fill(dataset1, "bank_total");
adapter.Fill(dataset1, "bank_lease");
}
finally
{
command.Dispose();
connection.Close();
}
test1.SetDataSource (dataset1);
CrystalReportViewer1.ReportSource = test1;
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
test1 = new SPROC.test();
base.OnInit(e);
}
|
|
Reply By:
|
gradyj
|
Reply Date:
|
6/17/2005 6:35:30 PM
|
I think you will need to bind the subreports to thier respective data tables, then show the report...
example:
rpt.SetDataSource(rptDs.Tables(0)) rpt.Subreports.Item("subOrgAddresses").SetDataSource(rptDs.Tables(1)) rpt.Subreports.Item("subAutoMakersUsed").SetDataSource(rptDs.Tables(2))
|
|
Reply By:
|
alimaisum
|
Reply Date:
|
8/15/2005 3:31:21 PM
|
How come I cann't access "Item" in rpt.Subreports.Item
Is there any library that I should include? Plz let me know Thanks in advance.
|
|