Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Crystal Report in ASP.NET

Crystal Report in ASP.NET

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasehelpasp-netsysadmin
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    senthilsstil
    wrote on last edited by
    #1

    Hi Friends, I m doing crystal report in asp.net2.0 using c#,i have written the code for crystal report dynamically getting the database connection from web.config file and i have created the crystal report manually making the database connection mapping the stored procedure.I m getting the output correctly.The problem is if i need to change the database server name means i should change only in web.config file,but i have given the connection for crystal report in code behind and crystal report manually.When i change the database server name in web.config file its not getting the effect only when i connect crystal report manually its getting connected.Sorry for long comments here is the coding for database connection.Please help me to solve the solution protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { string from = ""; string id = ""; string to = ""; string mode = ""; from =Request.QueryString["FromDate"]; id = Request.QueryString["id"]; to = Request.QueryString["toDate"]; mode =Request.QueryString["mode"]; ReportDocument rd = new ReportDocument(); rd.Load(Server.MapPath("TourOperator.rpt")); rd.SetParameterValue(0, mode); rd.SetParameterValue(1, id); rd.SetParameterValue(2, from); rd.SetParameterValue(3, to); GetServerName(rd); Session["torRep"] = rd; foreach (CrystalDecisions.CrystalReports.Engine.ReportObject obj in rd.ReportDefinition.ReportObjects) { if (obj.Name == "txtfromdate") { ((TextObject)obj).Text = from; } if(obj.Name=="txttodate") { ((TextObject)obj).Text = to; } } if (rd.Rows.Count > 0) { CrystalReportViewer1.Visible = true; CrystalReportViewer1.ReportSource = rd; CrystalReportViewer1.DataBind(); } else { CrystalReportViewer1.Visible = false; ltl.Text = "<b><font color='red'>No Records Found</font></b>"; } } else { CrystalReportViewer1.ReportSource = (ReportDocument)Session["torRep"];

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups