-
Crystal report printing in VS but not in IIS
I need to bypass the print process of crystal report. With so much searching over the net I found these codes. Its printing in VS 2005 Team Edition for Developers but when I publish it to the IIS 5.1 its not printing. Any tips?
using System.Web.UI;using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
public partial class _Default : System.Web.UI.Page
{
private ReportDocument northwindCustomersReport;
private void ConfigureCrystalReports()
{
northwindCustomersReport = new ReportDocument();
string reportPath = Server.MapPath("CrystalReport2.rpt");
northwindCustomersReport.Load(reportPath);
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = "servername";
connectionInfo.DatabaseName = "dbname";
connectionInfo.UserID = "userid";
connectionInfo.Password = "password";
SetDBLogonForReport(connectionInfo,northwindCustomersReport);
CrystalReportViewer1.ReportSource = northwindCustomersReport;
northwindCustomersReport.PrintToPrinter(1, false, 1, 1);
}
private void Page_Init(object sender, EventArgs e)
{
ConfigureCrystalReports();
}
private void SetDBLogonForReport(ConnectionInfo connectionInfo, ReportDocument reportDocument)
{
Tables tables = reportDocument.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
{
TableLogOnInfo tableLogonInfo = table.LogOnInfo;
tableLogonInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(tableLogonInfo);
}
}
}
Similar Threads
-
By andreasg in forum VB Classic
Replies: 0
Last Post: 06-29-2006, 06:08 AM
-
By AM003295 in forum VB Classic
Replies: 4
Last Post: 08-12-2005, 09:13 PM
-
By Liz Romero in forum ASP.NET
Replies: 2
Last Post: 06-08-2002, 11:30 AM
-
By Monir Hossain in forum VB Classic
Replies: 0
Last Post: 08-11-2001, 03:18 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|