this is my Design Page
=====================
<%@ 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.