Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

passing parameters through crystal reports

Posted on 2005-04-28
6
Medium Priority
?
456 Views
Last Modified: 2012-06-27
I am trying to pass my paramter through my crystal report. I am very close.
I had problems earlier with my odbc maker so I had to create my own command. When I created my own select command I started to get the information I required.

Database used MySql

this is my command
Select Work_Order_ID ,Ship_To, Address, City, Province, Postal_Code, Phone_Number, Quantity, Product_name, Subtotal, Total from invoice Inner join invoiceproduct on invoiceproduct.Invoice_ID = invoice.Invoice_ID where Work_Order_ID =   ' {?workOrderID}'

this is my vb code on the form

       Dim rpt As New CrystalReport1
   
       rpt.SetParameterValue("workOrderID", "WO-000014")
       CrystalReportViewer1.ReportSource = rpt


The parameter will display on the screen when I run it, but the workOrderID is not getting passed to my  sqlcommand

if I make my command hardcoded

Select Work_Order_ID ,Ship_To, Address, City, Province, Postal_Code, Phone_Number, Quantity, Product_name, Subtotal, Total from invoice Inner join invoiceproduct on invoiceproduct.Invoice_ID = invoice.Invoice_ID where Work_Order_ID =   'WO-000014'

it will bring back all my information

if i get rid of the quotes in my select statement

Select Work_Order_ID ,Ship_To, Address, City, Province, Postal_Code, Phone_Number, Quantity, Product_name, Subtotal, Total from invoice Inner join invoiceproduct on invoiceproduct.Invoice_ID = invoice.Invoice_ID where Work_Order_ID ={?workOrderID}

i get this error

Failed to open rowset. SQLBindParameter not used for all parameters.

how can I pass my parameter to my sqlCommand?

PLEASE HELP





0
Comment
Question by:genesisproject
  • 3
  • 2
6 Comments
 
LVL 9

Assisted Solution

by:cyberdevil67
cyberdevil67 earned 600 total points
ID: 13892091
Hi genesisproject,

  Don't use ODBC, use the OLE DB (ADO) type of connection instead, then you will not need to setup ODBC settings on any computer it gets deployed too. But you should also add

  Report.SetDatabaseLogon("username", "password") to logon to the database...

 

Cheers!
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 900 total points
ID: 13892131
You need to pass a string so enclose it in ' '

Pass it as

 rpt.SetParameterValue("workOrderID", "'WO-000014'")

mlmcc
0
 

Author Comment

by:genesisproject
ID: 13892134
thanks for the input but I will play with that later.  I still would like to know how to pass a parameter to my command
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
LVL 101

Accepted Solution

by:
mlmcc earned 900 total points
ID: 13894187
To pass it to the Command you have to pass it to the report.

rpt.SetParameterValue("workOrderID", "'WO-000014'")

or it may be

rpt.SetParameterValue("{?workOrderID}", "'WO-000014'")

mlmcc
0
 

Author Comment

by:genesisproject
ID: 13895024
the paramenter is getting there already but in my select statement it is not reading. WHy
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 13898571
Check to see if you have SAVED DATA

Open the report
Click FILE
Ensure SAVE DATA WITH REPORT is unchecked.

Glad i could help

mlmcc
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

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…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

580 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