水晶报表里的数据从,链接数据库都一切正常。
下面是代码。 private ReportDocument reportDocument;
private void button13_Click(object sender, EventArgs e)
{
ReportDocument _rpt1;
_rpt1.Load(StartPath + "\\rpt\\HzGBD2.rpt");
DataSet ds = new DataSet();
DataTable ds1 = truckDal.GetSqltb(" select TID as 序号,NoteCode as 流水编号,PlateCode as 车牌号, Goods as 货物名称, guige as 规格, Weight as 皮重,GrossWeight as 毛重,NetWeight as 净重 from Table1 where TID = " + int.Parse(label35.Text.Substring(8, label35.Text.Length - 8)) + "");
DataTable ds2 = truckDal.GetSqltb("select NoteCode as 流水编号,Goods as 货物名称,Guige as 规格,Unit as 单价,Counts as 数量,Price as 金额 from Table2 where NoteCode='" + label35.Text + "'");
ds.Tables.Add(ds1);
ds1.TableName = "Table1";
ds.Tables.Add(ds2);
ds2.TableName = "Table2"; ds.Relations.Add(new DataRelation("link", ds1.Columns["流水编号"], ds2.Columns["流水编号"]));
_rpt1.SetDataSource(ds); crystalReportViewer1.ReportSource = _rpt1;
}
就是不显示数据。为什么
下面是代码。 private ReportDocument reportDocument;
private void button13_Click(object sender, EventArgs e)
{
ReportDocument _rpt1;
_rpt1.Load(StartPath + "\\rpt\\HzGBD2.rpt");
DataSet ds = new DataSet();
DataTable ds1 = truckDal.GetSqltb(" select TID as 序号,NoteCode as 流水编号,PlateCode as 车牌号, Goods as 货物名称, guige as 规格, Weight as 皮重,GrossWeight as 毛重,NetWeight as 净重 from Table1 where TID = " + int.Parse(label35.Text.Substring(8, label35.Text.Length - 8)) + "");
DataTable ds2 = truckDal.GetSqltb("select NoteCode as 流水编号,Goods as 货物名称,Guige as 规格,Unit as 单价,Counts as 数量,Price as 金额 from Table2 where NoteCode='" + label35.Text + "'");
ds.Tables.Add(ds1);
ds1.TableName = "Table1";
ds.Tables.Add(ds2);
ds2.TableName = "Table2"; ds.Relations.Add(new DataRelation("link", ds1.Columns["流水编号"], ds2.Columns["流水编号"]));
_rpt1.SetDataSource(ds); crystalReportViewer1.ReportSource = _rpt1;
}
就是不显示数据。为什么
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货