locked
Crystal report basic testing conflict RRS feed

  • Question

  • User-1187238583 posted

    Hi, 

     I am new to the crystal report and i am going through some tutorial (link : http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-stepbystep.htm) which explains step by step procedure od the crystal report working. I am doing as exactyly given in the tutorial but i am not getting the same result in the case of Multiple string method. I am pasting my code behind here, can any one tell me what might be the problem. The only change i have made is instead of stored procedure i am using configured server database.

    Code behind:

    using System;
    using System.Collections;
    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.Xml.Linq;
    using CrystalDecisions.CrystalReports.Engine;
    using CrystalDecisions.Shared;

    namespace CrstalReportTest
    {
    public partial class _Default : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void Button1_Click(object sender, EventArgs e)
    {
    ReportDocument cryRpt = new ReportDocument();
    cryRpt.Load("C:\\Users\\Public\\Documents\\Visual studio testing\\CrstalReportTest\\CrstalReportTest\\MultipleString.rpt");

    ParameterFieldDefinitions crParameterFieldDefinitions ;
    ParameterFieldDefinition crParameterFieldDefinition ;
    ParameterValues crParameterValues = new ParameterValues();
    ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

    crParameterDiscreteValue.Value = txtString.Text;
    crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
    crParameterFieldDefinition = crParameterFieldDefinitions["customername"];
    crParameterValues = crParameterFieldDefinition.CurrentValues;

    crParameterValues.Clear();
    crParameterValues.Add(crParameterDiscreteValue);
    crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

    CrystalReportViewer1.ReportSource = cryRpt;
    CrystalReportViewer1.RefreshReport();


    }
    }
    }

    Friday, March 23, 2012 10:41 PM

All replies