Solved

Error when passing parameters to Crystal Reports

Posted on 2007-04-03
4
253 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
Comment Utility
Try setting the parameter after you set the data source.

mlmcc
0
 

Author Comment

by:ljhodgett
Comment Utility
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
Comment Utility
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
Comment Utility
Glad i could help

mlmcc
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now