A12116 于 2015.06.10 11:20 提问
- C#水晶报表不显示数据?
-
数据库是sqlite,代码如下,什么推模式拉模式的不懂呀。。
SQLiteConnection conn = new SQLiteConnection("Data Source=equipment.db");
conn.Open();
SQLiteCommand comm = new SQLiteCommand("select eqName,model,danwei,count,price,total from storeA", conn);
SQLiteDataAdapter adapter = new SQLiteDataAdapter(comm);
DataSet set = new DataSet();
adapter.Fill(set,"storeA");
ReportDocument myReport = new ReportDocument();
string reportPath = Application.StartupPath + "\CrystalReport1.rpt";
myReport.Load(reportPath);
//绑定数据集
myReport.SetDataSource(set.Tables[0].DefaultView);cReportViewer1.ReportSource = myReport; cReportViewer1.RefreshReport(); conn.Close();
-
-
Tiger_Zhao
2015.06.10 11:29
- 已采纳
A)列头的文本要加在报表头或新建的一个分组头上。
B)详细资料中没有添加/关联字段,文本是不会显示字段值的。
C)确认一下 set.Tables[0].DefaultView 里面的行数。
-
-
Tiger_Zhao
回复石之审判: 直接在工程种设计的报表,为什么还要
Load(reportPath)
? - 接近 3 年之前 回复
-
- Tiger_Zhao 回复石之审判: 设计报表拖字段的时候没有用相同的数据源吗?
- 接近 3 年之前 回复
-
-
Tiger_Zhao
试试
myReport.SetDataSource(set.Tables[0]);
,不要DefaultView
。 - 接近 3 年之前 回复
-
-
caozhy
2015.06.10 11:30
目测没有取到数据,下个断点调试下,看看返回了数据没有