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. General Programming
  3. C#
  4. Crystal Report using a parameterized Stored Procedure

Crystal Report using a parameterized Stored Procedure

Scheduled Pinned Locked Moved C#
databasehelpdesignsysadminsecurity
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

    Hi, i don't understand the error i encountered when using a parameterized Stored Procedure in my Crystal report.... below is my coding: 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 { private ReportDocument CreateCrystalReportDocument() { ReportDocument rpt = new ReportDocument(); string reportPath = Server.MapPath("MyCrReport.rpt"); rpt.Load(reportPath); ConnectionInfo connectionInfo = new ConnectionInfo(); connectionInfo.ServerName = @"MyServer"; connectionInfo.DatabaseName = "MyDatabase"; connectionInfo.UserID = "MyUserId"; connectionInfo.Password = "MyPassword"; Tables tables = rpt.Database.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables) { TableLogOnInfo tableLogonInfo = table.LogOnInfo; tableLogonInfo.ConnectionInfo = connectionInfo; table.ApplyLogOnInfo(tableLogonInfo); } ParameterField paramField; ParameterDiscreteValue discreteVal = ParameterDiscreteValue(); //the next line encounters an error occur // 'crystalReportViewer1.ParameterFieldInfo is NULL' paramField = crystalReportViewer1.ParameterFieldInfo["@boardTitle"]; //----------------- //the next line did not encounter error on this line but an //error occur after exiting // this method === error value expected at parameter "@boardTitle" // paramField = rpt.ParameterFieldInfo["@boardTitle"]; discreteVal.Value = "Sample"; paramField.CurrentValues.Add(discreteVal); return rpt; } private void Page_Init(object sender, EventArgs e) { ReportDocument rpt = null; rpt = CreateCrystalReportDocument(null, "ProductName"); CrystalReportViewer1.ReportSource = rpt; } } anybody who can correct my coding.... thank you in advance to those who can help...

    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