石之审判 2015-06-10 03:20 采纳率: 100%
浏览 2646
已采纳

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();

刚刚接触这玩意,设计的时候已经加了表头字段,如图
设计

运行结果如下;
运行结果

数据库里面storeA表是有数据的:
图片说明

  • 写回答

2条回答

  • Tiger_Zhao 2015-06-10 03:29
    关注

    A)列头的文本要加在报表头或新建的一个分组头上。
    B)详细资料中没有添加/关联字段,文本是不会显示字段值的。
    C)确认一下 set.Tables[0].DefaultView 里面的行数。

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题
  • ¥15 Python时间序列如何拟合疏系数模型