Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Error when passing parameters to Crystal Reports

Posted on 2007-04-03
4
257 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

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. …
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

791 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