问题描述
- 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();
解决方案
A)列头的文本要加在报表头或新建的一个分组头上。
B)详细资料中没有添加/关联字段,文本是不会显示字段值的。
C)确认一下 set.Tables[0].DefaultView 里面的行数。
解决方案二:
目测没有取到数据,下个断点调试下,看看返回了数据没有