我有这个CrystalReport,此报告显示来自4个数据表的数据 表格是,产品,订单,发票和客户 我的问题是报告显示我添加的所有数据,但不显示客户列。
当我尝试将任何列从客户添加到报告中时,报告会显示为空,并且不显示任何内容。
我创建了一个数据集作为数据源,并确保数据集由数据填充。
这是填充数据集的代码
public ActionResult Report(int CustmId, int OrderId)
{
DataSet1 ds = new DataSet1();
ds.EnforceConstraints = false;
SqlConnection con = new SqlConnection("Data Source=ENTERPRISE-PC;Initial Catalog=Fakturor;Integrated Security=True");
con.Open();
String query = "select * From Customer where id= "+CustmId+"";
SqlDataAdapter adapter = new SqlDataAdapter(query, con);
adapter.Fill(ds,"Customer");
adapter = new SqlDataAdapter("SELECT * from Products v JOIN OrderVaror ov on v.id = ov.IdVara where ov.IdOrder = "+OrderId+"", con);
adapter.Fill(ds,"Products ");
adapter = new SqlDataAdapter("SELECT * from [Order] where id ="+OrderId+"",con);
adapter.Fill(ds, "Order");
adapter = new SqlDataAdapter("Select id, Datum, Price, PaymentDay, moms from Invoice", con);
adapter.Fill(ds, "Invoice");
con.Close();
ReportDocument rd = new ReportDocument();
rd.Load(Path.Combine(Server.MapPath("~/Repport/CrystalReport1.rpt")));
rd.SetDataSource(ds);
Response.Buffer = false;
Response.ClearContent();
Response.ClearHeaders();
try
{
Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
stream.Seek(0, SeekOrigin.Begin);
// return View("ViewPage1");
return File(stream, "application/pdf", "EverestList.pdf");
}
catch (Exception ex)
{
throw;
}
}