水晶报表应用之登录失败及导出解决方案
2004-12-23 19:25
316 查看
ReportDocument rd = new ReportDocument();
private void setcry()
{
TableLogOnInfo t=new TableLogOnInfo();
rd.Load(Server.MapPath("CrystalReport1.rpt")); //Load the Crystal Report
t.ConnectionInfo.ServerName="localhost"; //log the connection info here
t.ConnectionInfo.DatabaseName="Northwind";
t.ConnectionInfo.UserID="xxx";
t.ConnectionInfo.Password="xxx";
rd.Database.Tables["Categories"].ApplyLogOnInfo(t);//Save the connection info
DiskFileDestinationOptions dd = new DiskFileDestinationOptions();
string pdfname= @"..\CrystalReport1.pdf";
dd.DiskFileName =pdfname; //Save as a PDF file
rd.ExportOptions.DestinationOptions = dd;
rd.ExportOptions.ExportDestinationType=ExportDestinationType.DiskFile;
rd.ExportOptions.ExportFormatType=ExportFormatType.PortableDocFormat; // set the PDF format
rd.Export();
rd.Close();
Response.ClearContent(); //And the write the PDF file to the page
Response.ClearHeaders();
Response.ContentType="application/pdf";
Response.WriteFile(pdfname);
Response.Flush();
Response.Close();
}
private void setcry()
{
TableLogOnInfo t=new TableLogOnInfo();
rd.Load(Server.MapPath("CrystalReport1.rpt")); //Load the Crystal Report
t.ConnectionInfo.ServerName="localhost"; //log the connection info here
t.ConnectionInfo.DatabaseName="Northwind";
t.ConnectionInfo.UserID="xxx";
t.ConnectionInfo.Password="xxx";
rd.Database.Tables["Categories"].ApplyLogOnInfo(t);//Save the connection info
DiskFileDestinationOptions dd = new DiskFileDestinationOptions();
string pdfname= @"..\CrystalReport1.pdf";
dd.DiskFileName =pdfname; //Save as a PDF file
rd.ExportOptions.DestinationOptions = dd;
rd.ExportOptions.ExportDestinationType=ExportDestinationType.DiskFile;
rd.ExportOptions.ExportFormatType=ExportFormatType.PortableDocFormat; // set the PDF format
rd.Export();
rd.Close();
Response.ClearContent(); //And the write the PDF file to the page
Response.ClearHeaders();
Response.ContentType="application/pdf";
Response.WriteFile(pdfname);
Response.Flush();
Response.Close();
}
相关文章推荐
- 水晶报表应用之登录失败及导出解决方案
- 水晶报表导出问题:CrystalDecisions.CrystalReports.Engine.LogOnException登录失败
- 水晶报表应用之登录失败及导出解决方案
- 水晶报表9.0出现“登陆失败”错误的解决方案
- Crystal 三种报表解决方案大对比:.NET 对象模型,报表应用服务器对象模型,水晶企业对象模型
- Crystal 三种报表解决方案大对比:.NET 对象模型,报表应用服务器对象模型,水晶企业对象模型
- 水晶报表导出Excel多出空白页不完全解决方案
- winform 水晶报表导出Excel无边框线的解决方案
- 水晶报表在导出的时候常见的错误及解决方案汇总(从CO的KB里收集的)
- 解决水晶报表连接ORACLE数据库登录失败问题
- 水晶报表的使用——解决登录失败的问题 Pull
- 水晶报表导出到客户端
- ActiveReports 报表应用教程 (10)---交互式报表之向下钻取(详细数据按需显示解决方案)
- ActiveReports 报表应用教程 (16)---报表导出
- 【水晶报表实例应用】一页分上下两部分列印
- VS2010中水晶报表应用与部署
- 使用eclipse在jsp上显示水晶报表(五)viewer标签应用
- Web应用导出Excel报表的简单实现(HTML)
- 水晶报表如何完美导出一个Excel表格(收藏)
- 浅谈水晶报表在ASP.NET中的一种灵活应用