enter image description here我有一个Windows窗体应用程序,其中使用了Crystal报表。在主Crystal报表中,我想显示子报表,但是当我尝试显示时,它会显示Main-Report的数据,而其他子报表数据未显示。我尝试了以下代码,但不起作用。请帮助我提供代码问题或子报表链接问题的详细信息?
{
SqlCommand command1 = new SqlCommand("packinglistreport", con);
command1.CommandType = CommandType.StoredProcedure;
command1.Parameters.Add("@id1", SqlDbType.Int).Value = 4;
command1.Parameters.Add("@contno", SqlDbType.NVarChar).Value = textBox1.Text;
command1.Parameters.Add("@season_no", SqlDbType.NVarChar).Value = textBox2.Text;
SqlDataAdapter da121 = new SqlDataAdapter(command1);
SqlCommand command = new SqlCommand("packinglistreport", con);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@id1", SqlDbType.Int).Value = 5;
command.Parameters.Add("@contno", SqlDbType.NVarChar).Value = textBox1.Text;
command.Parameters.Add("@season_no", SqlDbType.NVarChar).Value = textBox2.Text;
SqlDataAdapter da12 = new SqlDataAdapter(command);
SqlCommand command2 = new SqlCommand("packinglistreport", con);
command2.CommandType = CommandType.StoredProcedure;
command2.Parameters.Add("@id1", SqlDbType.Int).Value = 6;
command2.Parameters.Add("@contno", SqlDbType.NVarChar).Value = textBox1.Text;
command2.Parameters.Add("@season_no", SqlDbType.NVarChar).Value = textBox2.Text;
SqlDataAdapter da122 = new SqlDataAdapter(command2);
SqlCommand command3 = new SqlCommand("packinglistreport", con);
command3.CommandType = CommandType.StoredProcedure;
command3.Parameters.Add("@id1", SqlDbType.Int).Value = 7;
command3.Parameters.Add("@contno", SqlDbType.NVarChar).Value = textBox1.Text;
command3.Parameters.Add("@season_no", SqlDbType.NVarChar).Value = textBox2.Text;
SqlDataAdapter da123 = new SqlDataAdapter(command3);
DataSet ds7 = new DataSet();
packinvoicereportotto cr5 = new packinvoicereportotto();
da121.Fill(ds7, "packinglistdt");
da12.Fill(ds7, "packinglistdt1");
da122.Fill(ds7, "packinglistdt2");
da123.Fill(ds7, "packinglistdt3");
if (ds7.Tables[0].Rows.Count == 0 && ds7.Tables[1].Rows.Count == 0 && ds7.Tables[2].Rows.Count == 0 && ds7.Tables[3].Rows.Count == 0)
{
MessageBox.Show("No data Found");
return;
}
cr5.SetDataSource(ds7);
Report re = new Report();
re.MdiParent = this.MdiParent;
re.Text = "Packing List Report";
re.Show();
re.crystalReportViewer1.ReportSource = cr5;
re.crystalReportViewer1.DataBindings.Clear();
}