Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
| Search | Today's Posts | Mark Forums Read
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 17th, 2007, 05:22 PM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parameter Entry Page Still Appears

Please could someone help me, I am new and I am trying my first ever crystal report. The only crystal report i have is bundled with vb.net 2005 version. I have read lots of articals and followed examplews BUT i still get the Parameter entry page coming up. I have a stored procedure which had 5 variables declared. The stored procedure works!!

Thanks in advance

the code i am using is

using System;
using System.Data;
using System.Configuration;
using System.Data.SqlClient; /*Enables SqlConnection and get data from database without can not use SqlConnection */
using System.Collections;
using System.IO;
using System.Web;
using System.Web.Services;
using System.Web.Security;
using System.Web.SessionState;
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;
using System.Globalization;




public partial class Default2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ReportDocument cr = new ReportDocument();
        ParameterField paramField = new ParameterField();
        ParameterFields Paramfields = new ParameterFields();
        ParameterDiscreteValue paramDiscretevalue = new ParameterDiscreteValue();

        paramField.Name = "@AssignRole";
        paramDiscretevalue.Value = "0";
        paramField.CurrentValues.Add(paramDiscretevalue);
        Paramfields.Add(paramField);

        paramField = new ParameterField();
        paramField.Name = "@ProjectID";
        paramDiscretevalue = new ParameterDiscreteValue();
        paramDiscretevalue.Value = "0";
        paramField.CurrentValues.Add(paramDiscretevalue);
        Paramfields.Add(paramField);

        paramField = new ParameterField();
        paramField.Name = "@Role";
        paramDiscretevalue = new ParameterDiscreteValue();
        paramDiscretevalue.Value = "1";
        paramField.CurrentValues.Add(paramDiscretevalue);
        Paramfields.Add(paramField);

        paramField = new ParameterField();
        paramField.Name = "@StaffID";
        paramDiscretevalue = new ParameterDiscreteValue();
        paramDiscretevalue.Value = "0";
        paramField.CurrentValues.Add(paramDiscretevalue);
        Paramfields.Add(paramField);

        paramField = new ParameterField();
        paramField.Name = "@TaskType";
        paramDiscretevalue = new ParameterDiscreteValue();
        paramDiscretevalue.Value = "1";
        paramField.CurrentValues.Add(paramDiscretevalue);
        Paramfields.Add(paramField);

        cr.Load(@"C:\Web Sites\NODDY\OutstandingIssuelReport.rpt");
        CrystalReportViewer1.ReportSource = cr;
        CrystalReportViewer1.ParameterFieldInfo = Paramfields;
        CrystalReportViewer1.DataBind();
        CrystalReportViewer1.RefreshReport();
 
Old June 26th, 2007, 02:53 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Require the following namespaces
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportSource;
using CrystalDecisions.Windows.Forms;
using CrystalDecisions.Shared;


ReportDocument cr = new ReportDocument();
ParameterValues parameter1 = new ParameterValues();
ParameterDiscreteValue parametervalue = new ParameterDiscreteValue();

//Make sure you have the the correct mapPath set
cr.Load(Server.MapPath("testCrystalReport.rpt"));

//Set the parameters of the stored procedure
parametervalue.Value = Session["project"];
parameter1.Add(parametervalue);
cr.DataDefinition.ParameterFields["@ProjectID"].ApplyCurrentValues(parameter1);

parametervalue.Value = Session["staff"];
parameter1.Add(parametervalue);
cr.DataDefinition.ParameterFields["@StaffID"].ApplyCurrentValues(parameter1);

//Set a value from result set of a query
parametervalue.Value = ViewState["ProjName"];
parameter1.Add(parametervalue);
cr.DataDefinition.ParameterFields["NameofProject"].ApplyCurrentValues(parameter1);

//Refresh the report
CrystalReportViewer1.ReportSource = cr;

Yazzy
Springwater Software Ltd









Similar Threads
Thread Thread Starter Forum Replies Last Post
Session/Cookie Expires, Login page appears rajn ASP.NET 1.0 and 1.1 Professional 3 June 27th, 2007 06:19 AM
Duplicate database entry redirection error page EmWebs Dreamweaver (all versions) 3 December 29th, 2006 10:17 AM
Duplicate database entry redirection error page EmWebs Access ASP 0 December 27th, 2006 12:54 PM
passing parameter from js to another jsp page. Regornil JSP Basics 1 August 31st, 2004 08:23 AM
Adding second parameter to open page nbryson ADO.NET 0 September 18th, 2003 06:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.