Click here to Skip to main content
15,905,504 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Dear All,

I have Created a Web Application, in that am using cyrstal reports to print the data.

I have displayed data in crystal report using dataset...its running fine.

after creating this application i have hosted this web application into IIS Webserver.

am unable to print the crystal report data after hosting in server.

I can print from my local pc...but unable to print after hosting in server.

Please help me, and give me a good solution for this,

Thanks for ever !!
Posted
Comments
ythisbug 9-Jul-12 2:54am    
can u show us code how u tried for print?tat we can help u?

1 solution

this is my Design Page
=====================

XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SelectedReport.aspx.cs" Inherits="Users_SelectedReport" %>

<%@ Register Assembly="CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"
    Namespace="CrystalDecisions.Web" TagPrefix="CR" %>

<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
    Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Selected | Print Report</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
    </div>
    </form>
</body>
</html>







THis is my code page
====================

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Collections;
using System.Xml.Linq;
using System.Data.SqlClient;
using CrystalDecisions.Shared;
using CrystalDecisions.CrystalReports.Engine;

public partial class Users_SelectedReport : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument rptDoc = new ReportDocument();
//Flights ds = new Flights(); // .xsd file name
SelectedDataSet ds = new SelectedDataSet();

//DataTable dt = new DataTable();
//// Just set the name of data table
//dt.TableName = "Crystal Report Example";
//dt = Session["dataTable"]; //This function is located below this function
//ds.Tables[0].Merge(dt);
// Your .rpt file path will be below
rptDoc.Load(Server.MapPath("SelectedCrystalReportColumn.rpt"));
//set dataset to the report viewer.
rptDoc.SetDataSource(Session["dataTable"]);
CrystalReportViewer1.ReportSource = rptDoc;
}



public DataTable getAllOrders()
{
//Connection string replace 'databaseservername' with your db server name


string sqlCon = "server=hyd01; Integrated Security=True;INITIAL CATALOG=infoDB;PERSIST SECURITY INFO=FALSE;Connect Timeout=0";

SqlConnection Con = new SqlConnection(sqlCon);
SqlCommand cmd = new SqlCommand();
DataSet ds = null;
SqlDataAdapter adapter;
try
{
Con.Open();
//Stored procedure calling. It is already in sample db.
cmd.CommandText = "SELECT [ClearanceNumber],[CodeFlightId],DateLastChange,DateValidFrom,DateValidTo,[ReservationNo],[AircraftType],[CityCode],[days_t] as [Days] FROM [Flight] where [ClearanceNumber] = '" + Request.QueryString["clr"] + "'";
cmd.CommandType = CommandType.Text;
cmd.Connection = Con;
ds = new DataSet();
adapter = new SqlDataAdapter(cmd);
adapter.Fill(ds, "Users");
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
finally
{
cmd.Dispose();
if (Con.State != ConnectionState.Closed)
Con.Close();
}
return ds.Tables[0];
}
}



Please help me, Thanks in ADVANCE.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900