using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.HtmlControls; using CrystalDecisions.Web; using System.Web.UI.WebControls.WebParts; using CrystalDecisions.CrystalReports.Engine; using CrystalDecisions.Shared; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Xml.Linq; using System.Web.SessionState; namespace SACSCOCLogin1._1 { public partial class ReportFormA : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string SelectFormula = "{COCINST.inst_id} > 10000 " + "AND Mid({COCINST.LongName}, 1, 1) = \"A\""; } CrystalReportViewer1.Visible = true; ReportDocument crystalReport = new ReportDocument(); crystalReport.Load(Server.MapPath("~/Reports/ReportA.rpt")); CrystalReportViewer1.ReportSource = crystalReport; CrystalReportViewer1.SelectionFormula = "{COCINST.inst_id} = '" + Session["inst_id"].ToString() + "'"; //CrystalReportViewer1.SelectionFormula = "{FIN2013.inst_id} = '" + Session["inst_id"].ToString() + "'"; } protected override void OnPreRender(EventArgs e) { Session["inst_id"] = "inst_id"; CrystalReportViewer1.Visible = true; ReportDocument crystalReport = new ReportDocument(); crystalReport.Load(Server.MapPath("~/Reports/ReportA.rpt")); crystalReport.SetDatabaseLogon ("Admin", "master22", @"SQL", "Hot"); CrystalReportViewer1.ReportSource = crystalReport; CrystalReportViewer1.SelectionFormula = "{COCINST.inst_id} = '" + Session["inst_id"].ToString() + "'"; //CrystalReportViewer1.SelectionFormula = "{FIN2013.inst_id} = '" + Session["inst_id"].ToString() + "'"; } } }
Selectionformula
crystalReportViewer.SelectionFormula = "{Table.inst_id} = "'" + Session["inst_id"].ToString() + "'";
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)