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. Changing Crystalreport server in run time

Changing Crystalreport server in run time

Scheduled Pinned Locked Moved ASP.NET
helpdatabasedesignsysadminsecurity
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.
  • T Offline
    T Offline
    The_Collector
    wrote on last edited by
    #1

    hello everybody, I descovered lately that SetDatabaseLogon will not allow us to change the server name.... i find some blogs but all of it ends up n vain.... my code below encountered an error "Procedure 'gg_TestSource' expects parameter '@pServer', which was not supplied".... im almost running out of time with myu project deadline.... i need someone who could help..... please please please... tnx n advance.... using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; 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 { protected void Page_Load(object sender, EventArgs e) { ParameterDiscreteValue discreteBranch = new ParameterDiscreteValue(); ParameterFields paramFields = new ParameterFields(); ReportDocument rpt = new ReportDocument(); rpt.Load(Server.MapPath("~/MyCrystalReport.rpt")); // changing my testing servername to production servername Database crSubDB; Tables crTables; ConnectionInfo cInfo = new ConnectionInfo(); cInfo.ServerName = "ProductionServer"; cInfo.UserID = "myUserID"; cInfo.Password = "myPassword"; cInfo.DatabaseName = "MyTable"; crSubDB = rpt.Database; crTables = crSubDB.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables) { TableLogOnInfo crTableLogOnInfo = crTable.LogOnInfo; crTableLogOnInfo.ConnectionInfo = cInfo; crTable.ApplyLogOnInfo(crTableLogOnInfo); } /// ParameterDiscreteValue paramDiscreteBranch = new ParameterDiscreteValue(); ParameterField paramFieldBranch = new ParameterField(); paramFieldBranch.Name = "@pServer"; paramDiscreteBranch.Value = "XX"; paramFieldBranch.CurrentValues.Add(paramDiscreteBranch); paramFields.Add(paramFieldBranch); rpt.SetParameterValue("@pServer", paramDiscreteBranch); CrystalReportViewer1.ParameterFieldInfo = paramFields; CrystalReportViewer1.ReportSource = rpt; } }

    xxx

    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