Advertisement

08.06.2004 at 04:25PM PDT, ID: 21085368
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.9

Passing parameter into Crystal Report

Asked by tlfeet in Crystal Reports Software

Tags: , ,

I am new to Crystal Report.  I am using VB.NET and Crystal Report 8.5

I created a report, when connecting to the database, I only see tables but not store procedures, I have all the access rights but the store procedures not show up in the wizards.  Any way, I just select the table name Fabric and field names.  
I want to display only one record, I look at show sql statement:
 SELECT "Fabric"."FabricID", "Fabric"."CustomerID", "Fabric"."FabricCode", "Fabric"."SMProjectName", "Fabric"."SMPlanID", "Fabric"."SMRoomName", "Fabric"."SupplierName", "Fabric"."PatternAndColor", "Fabric"."QtyReceived", "Fabric"."DocumentID"
 FROM   "enterprise"."dbo"."Fabric" "Fabric"
 WHERE  "Fabric"."FabricID"=222049

The FabricID need to be a parameter field.  So I insert a "Record Selection Formula" and name the field "fabricParam" and it formula was {Fabric.FabricID} = 222049.

My Webform1.aspx.vb code is:

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Public Class WebForm1
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents CrystalReportViewer1 As CrystalDecisions.Web.CrystalReportViewer

    'Dim crpt As CrystalReport1
    Dim crpt As crFabricLabel

    Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
    Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo

    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        'crpt = New CrystalReport1
        crpt = New crFabricLabel
        For Each myTable In crpt.Database.Tables
            myLogin = myTable.LogOnInfo
            myLogin.ConnectionInfo.Password = "pwd"
            myLogin.ConnectionInfo.UserID = "user"
            myTable.ApplyLogOnInfo(myLogin)
        Next

        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldDefinition As ParameterFieldDefinition

        Dim crParameterValues As New ParameterValues
        Dim crParameterDiscreteValue As New ParameterDiscreteValue

        'Set discrete value
        crParameterDiscreteValue.Value = CInt("1000002442")

        'Access first parameter field definition
        crParameterFieldDefinitions = crpt.DataDefinition.ParameterFields
        crParameterFieldDefinition = crParameterFieldDefinitions.Item("fabricParam")

        ' Add parameter value
        crParameterValues = crParameterFieldDefinition.CurrentValues

        crParameterValues.Add(crParameterDiscreteValue)

        ' Apply the current value to the parameter definition
        crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

        CrystalReportViewer1.ReportSource = crpt

    End Sub

End Class

When run the web form I got this error:

Exception Details: CrystalDecisions.CrystalReports.Engine.InvalidArgumentException: Invalid field name.

Source Error:


Line 51:         'Access first parameter field definition
Line 52:         crParameterFieldDefinitions = crpt.DataDefinition.ParameterFields
Line 53:         crParameterFieldDefinition = crParameterFieldDefinitions.Item("fabricParam")
Line 54:
Line 55:         ' Add parameter value
 
So can anybody help me how to put in a parameter field into the Crystal report form so that {Fabric.FabricID} = some variable instead of a pre-defined number.
The error message tell me that I have not define fabricParam anywhere in the form but It is there.
I will get to how to get store procedure, but that will be next.

Many thanks

Start Free Trial
[+][-]08.06.2004 at 06:19PM PDT, ID: 11740981

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.07.2004 at 12:22AM PDT, ID: 11741963

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.09.2004 at 12:03PM PDT, ID: 11756098

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.09.2004 at 12:14PM PDT, ID: 11756216

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Crystal Reports Software
Tags: crystal, report, parameter
Sign Up Now!
Solution Provided By: frodoman
Participating Experts: 4
Solution Grade: A
 
 
[+][-]08.09.2004 at 12:18PM PDT, ID: 11756273

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.09.2004 at 12:18PM PDT, ID: 11756274

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.09.2004 at 12:21PM PDT, ID: 11756307

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.09.2004 at 12:30PM PDT, ID: 11756408

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.09.2004 at 01:42PM PDT, ID: 11757064

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.09.2004 at 01:54PM PDT, ID: 11757203

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.09.2004 at 02:05PM PDT, ID: 11757306

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.26.2004 at 10:59AM PDT, ID: 12413751

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.27.2004 at 08:26AM PDT, ID: 12423257

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.11.2004 at 09:10AM PST, ID: 12556636

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32