Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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();
Reply With Quote
  #2 (permalink)  
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





Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:06 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.