passing parameters through crystal reports

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





genesisprojectAsked:
Who is Participating?
 
mlmccCommented:
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
 
cyberdevil67Commented:
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
 
mlmccCommented:
You need to pass a string so enclose it in ' '

Pass it as

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

mlmcc
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
genesisprojectAuthor Commented:
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
 
genesisprojectAuthor Commented:
the paramenter is getting there already but in my select statement it is not reading. WHy
0
 
mlmccCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.