导出水晶报表的内容? http://www.csdn.net/expert/topic/962/962116.xml?temp=.7566034 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 llllay() 怎么修改? 你在导出到XLS时.报表的对象是否还在?一般情况在用户需要时才导出.这时显示的报表对象已经销毁了.你可以在导出以前重新生成一个报表对象试试. 我确实重新生成了,你帮我看看private void Button1_Click(object sender, System.EventArgs e){ ClReport_ds MyReport = new ClReport_ds(); CrystalDecisions.Shared.DiskFileDestinationOptions DiskOpt = new CrystalDecisions.Shared.DiskFileDestinationOptions(); MyReport.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile; MyReport.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.Excel; DiskOpt.DiskFileName = "f:\\程序\\net\\MyWeb\\out.xls"; MyReport.ExportOptions.DestinationOptions = DiskOpt; MyReport.Export();}提示MyReport.Export();出错 http://www.csdn.net/expert/topic/939/939228.xml?temp=.2322199 总结了一下:如果数据库密码为空的话(我的测试是user id=sa;pwd=)可以直接使用下面代码:CrystalReportViewer1.ReportSource = Server.MapPath("CrystalReport1.rpt");CrystalReportViewer1.DataBind();如果数据库密码不为空的话,则应该添加以下代码安全登陆:ReportDocument Report = new ReportDocument();Report.Load(Server.MapPath("CrystalReport1.rpt"));TableLogOnInfo logOnInfo = new TableLogOnInfo();//对报表中的每个表进行循环for(int i=0;i==Report.DataBase.Tables.Count-1;i++){ logOnInfo.ConnectionInfo.UserId = "sa"; logOnInfo.ConnectionInfo.Password = "yourpassword"; Report.DataBase.Tables[i].ApplyLogOnInfo(logOnInfo);}CrystalReportViewer1.ReportSource = Report;CrystalReportViewer1.DataBind();//当然如果密码为空的话也同样可以使用这种方法的以上代码需要using CrystalDecisions.CrystalReports.Engine;using CrystalDecisions.Shared; MVC3的EF CODE碰到新问题 当单击注册按钮,如果没填写注册信息,会提示你填写,是脚本语言实现的,而没促发C#事件。。是什么原理啊 web用户控件 改id sql server打了sp4之后程序出错!! tabstrip的tab按钮如何放到在下面! @-急--System.IO.IOException: 磁盘空间不足--急急 在ASP.NET中使用存储过程:在传参数时为什么老是只能得到值的第一个字符。 ASP.NET数据实体模型保存数据的顺序问题 ASP.NET c# 新闻系统,内容 我发现了textbox一个有趣的现象,谁能解释一下 狂风系列问题:问飞不动的侠?
怎么修改?
private void Button1_Click(object sender, System.EventArgs e)
{
ClReport_ds MyReport = new ClReport_ds(); CrystalDecisions.Shared.DiskFileDestinationOptions DiskOpt = new CrystalDecisions.Shared.DiskFileDestinationOptions(); MyReport.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
MyReport.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.Excel;
DiskOpt.DiskFileName = "f:\\程序\\net\\MyWeb\\out.xls";
MyReport.ExportOptions.DestinationOptions = DiskOpt;
MyReport.Export();
}提示MyReport.Export();出错
如果数据库密码为空的话(我的测试是user id=sa;pwd=)可以直接使用下面代码:
CrystalReportViewer1.ReportSource = Server.MapPath("CrystalReport1.rpt");
CrystalReportViewer1.DataBind();如果数据库密码不为空的话,则应该添加以下代码安全登陆:ReportDocument Report = new ReportDocument();
Report.Load(Server.MapPath("CrystalReport1.rpt"));
TableLogOnInfo logOnInfo = new TableLogOnInfo();//对报表中的每个表进行循环
for(int i=0;i==Report.DataBase.Tables.Count-1;i++)
{
logOnInfo.ConnectionInfo.UserId = "sa";
logOnInfo.ConnectionInfo.Password = "yourpassword";
Report.DataBase.Tables[i].ApplyLogOnInfo(logOnInfo);
}
CrystalReportViewer1.ReportSource = Report;
CrystalReportViewer1.DataBind();
//当然如果密码为空的话也同样可以使用这种方法的以上代码需要
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;