Solved

Error when passing parameters to Crystal Reports

Posted on 2007-04-03
4
259 Views
Last Modified: 2012-05-05
Hi Experts,

I have the following code: -

        Dim dr As DataRow = DSTPurchaseOrder.Tables(0).NewRow
        dr(0) = "1"
        dr(1) = "2"
        dr(2) = "3"
        dr(3) = "4"
        dr(4) = "Another"
        dr(5) = "6"
        dr(6) = "7"
        dr(7) = "8"
        DSTPurchaseOrder.Tables(0).Rows.Add(dr)
        rpt.SetParameterValue("Company Name", txtCompanyName.Text)
        rpt.Load(Forms.Application.StartupPath & "\PurchaseOder.rpt")
        rpt.SetDataSource(DSTPurchaseOrder.Tables(0))
        CrystalReportViewer1.ReportSource = rpt

I am trying to populate a crystal report using vb.net 2005 with crystal reports bundelled with it. When the for loads despite me adding a paramter name “Company Name” when I send data to it it does not seem to work as when the report loads it says: -

Enter Parameter Values.
You can provide a single value for this paramter. Enter the value you want to include for “Company Name”

What am I doing wrong please. Sorry I am new to crystal reports.

Many Thanks
Lee
0
Comment
Question by:ljhodgett
  • 3
4 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 250 total points
ID: 18846292
Try setting the parameter after you set the data source.

mlmcc
0
 

Author Comment

by:ljhodgett
ID: 18846479
Hi Mlmcc,

Thank you for that I'll accept your answer. Out of curiosity why does it have to be set after the datasource.

Many Thanks
Lee
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18847589
I don't know.  That was basically a guess.

I suspect resetting the data source may reswet the parameters.

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 18851732
Glad i could help

mlmcc
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question