<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True" Visible=true
Height="1039px" Width="901px" /> ReportDocument rep1 = new ReportDocument();//定义ReportDocument类对象
string RptDir="E:\\杂七杂八\\CrystalReport.rpt";
rep1.Load(RptDir);
//rep1.Load(Server.MapPath(RptDir));//加载报表
SqlConnection con = new SqlConnection("....");
con.Open();
string strSql = "select * from p";
SqlDataAdapter da = new SqlDataAdapter(strSql,con);
DataSet ds = new DataSet();
da.Fill(ds, "p");
con.Close();
rep1.SetDataSource(ds.Tables["View_SYSIMENU"]);//加载数据源
this.CrystalReportViewer1.ReportSource = rep1;//为CrystalReportViewer控件指定报表
this.CrystalReportViewer1.DataBind();
并且加了CrystalReport.rpt 结果运行的时候程序还是出不了数据啊
Height="1039px" Width="901px" /> ReportDocument rep1 = new ReportDocument();//定义ReportDocument类对象
string RptDir="E:\\杂七杂八\\CrystalReport.rpt";
rep1.Load(RptDir);
//rep1.Load(Server.MapPath(RptDir));//加载报表
SqlConnection con = new SqlConnection("....");
con.Open();
string strSql = "select * from p";
SqlDataAdapter da = new SqlDataAdapter(strSql,con);
DataSet ds = new DataSet();
da.Fill(ds, "p");
con.Close();
rep1.SetDataSource(ds.Tables["View_SYSIMENU"]);//加载数据源
this.CrystalReportViewer1.ReportSource = rep1;//为CrystalReportViewer控件指定报表
this.CrystalReportViewer1.DataBind();
并且加了CrystalReport.rpt 结果运行的时候程序还是出不了数据啊
解决方案 »
- webservice如何进行访问控制?
- 如何按时间从一个文件夹获取部分文件移动
- 如何取出 Repeater 内的 Label 的 Text 值呢?
- 哈哈,发现一个奇怪的现象,有没有高手解释一下
- gridview更新时,无法获取更改后的编辑框的值~~~
- 把excel文件一起打包,安装后却没有在目录下,请教大家,是什么原因
- 百度接受参数的方法
- 公司的电子商务网站,请指教请提出宝贵意见若发现有bug重赏。http://expert.csdn.net/Expert/topic/2528/2528173.xml?temp=.4923822
- 大神们 看看 我哪里错了
- 页面中的一个activeX,我想activeX处理完任务后,能将处理结果提交给页面,怎么做才可以呢?
- TextBox文本框获得焦点的问题。
- 【向ALL提问】:号外!号外!!CSDN又要上新功能了!!!
2、你的报表CrystalReport.rpt 是如何设计的,设计时应该有强类型的DataSet来填充你的报表列
CrystalReport.rpt 只是设定了数据源,并没有设计具体的列要显示哪些字段,我在后台设置了查询数据的话,它应该默认可以显示所有的列啊
---------------------------
你没有设计报表,要他怎么显示出来啊。
当然你要把需要显示的列拉到报表里,进行设计后才可以嘛。
<body>
<form id="form1" runat="server">
<div>
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="True"
Height="1106px" Width="876px" ReportSourceID="CrystalReportSource1" />
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
<Report FileName="CrystalReport.rpt">
</Report>
</CR:CrystalReportSource>
</div>
</form>
</body>
可是还是显示不了数据
ReportDocument rDoc = new ReportDocument();
rDoc.Load(path);
rDoc.SetDataSource(dt);
crViewer.ReportSource = rDoc;