应该比较简单的问题,谁给解决了我马上给100分,说话算话!

feeling_vb 2005-03-23 11:43:38
我想把 DataSet 中的数据 榜定到一个 空的 水晶报表上,然后再在crystalReportViewer1 显示出来,可是现在 crystalReportViewer1 里面不显示;谁能知道怎么显示!

DataSet ds = new DataSet();

DataTable dt = new DataTable ("table");

dt.Columns.Add ( "a" );
DataRow row1 = dt.NewRow();

row1["a"] = "test";
dt.Rows.Add ( row1 );
ds.Tables.Add ( dt );

//this.c1FlexGrid1.DataSource = ds.Tables[0];
//c1FlexGrid1

report rep = new report();

rep.SetDataSource(ds);

this.crystalReportViewer1.ReportSource = rep;

...全文
162 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
cocotsy 2005-04-20
  • 打赏
  • 举报
回复
看见代码就晕。。。。。。。。。。。
会不会没有:acceptchanges
liuredstar 2005-04-14
  • 打赏
  • 举报
回复
gz
jhpu2000 2005-04-08
  • 打赏
  • 举报
回复
若采用数据集作为水晶的数据源,并且绑定,建议首先新建 .XSD 文件
silverseven 2005-04-06
  • 打赏
  • 举报
回复
首先请明确所谓的空报表,它不是说它不要任何东西。

做报表,建议先建.XSD,然后搭好报表模版(字段从.XSD中取)
用时赋你要显示的数据源,注意字段对应

Dim dry As New CrystalReport1
dry.SetDataSource(Datatable1)
CViewer1.ReportSource = dry

'push

绝对的动态是没有的,可以参阅:

http://blog.csdn.net/landlordh/archive/2005/01/31/274877.aspx
landlordh 2005-03-25
  • 打赏
  • 举报
回复
绝对的动态是没有的,可以参阅:

http://blog.csdn.net/landlordh/archive/2005/01/31/274877.aspx
freedom1980 2005-03-24
  • 打赏
  • 举报
回复
你把 rep.SetDataSource(ds);
改成 rep.SetDataSource(ds.table[0]);
feeling_vb 2005-03-23
  • 打赏
  • 举报
回复
这里有一个困难,就是我的报表出来的内容都不一样;可以说每次的字段都是动态的;而水晶报表好像不支持动态的报表;所以我把内容都装入了一个 DataSet,希望通过 绑定的方式 进行加载!!!
如果设计报表,就相当于国定了字段;这种情况有什么办法?
xwdd129 2005-03-23
  • 打赏
  • 举报
回复
正是,正规的报表设计应该是先设计报表文件,所谓的空报表是指空模板,而不是什么都不放!!
landlordh 2005-03-23
  • 打赏
  • 举报
回复
首先请明确所谓的空报表,它不是说它不要任何东西。

做报表,建议先建.XSD,然后搭好报表模版(字段从.XSD中取)
用时赋你要显示的数据源,注意字段对应

Dim dry As New CrystalReport1
dry.SetDataSource(Datatable1)
CViewer1.ReportSource = dry

'push
lyvvvv 2005-03-23
  • 打赏
  • 举报
回复
CrystalDecisions.CrystalReports.Engine.ReportDocument doc=new CrystalDecisions.CrystalReports.Engine.ReportDocument();
doc.Load(SysInfo.sReportPath+sReportname);
if(dsReport != null)doc.SetDataSource(dsReport.Tables[0]);
this.crystalReportViewer1.ReportSource=doc;
this.crystalReportViewer1.RefreshReport();

另外你首先要设计好报表,不能是空报表

4,816

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧