Solved

Error when passing parameters to Crystal Reports

Posted on 2007-04-03
4
256 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
cross tab report accumulative amount 9 51
display n/a in column 2 26
Crystal Reports Version 7 4 25
Sum not calculating correctly 22 30
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…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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