troubleshooting Question

Crystal Report Error "Missing parameter values." while Printing

Avatar of Avinash Desai
Avinash DesaiFlag for India asked on
Visual Basic.NETCrystal Reports
3 Comments1 Solution1606 ViewsLast Modified:
Dear all

I have a Windows service and I am passing the value to the Crystal report when the service is running .
After passing the value i am printing the report.

So i have written a code to pass the value and print the report.

Here is the code


   Dim crReportDocument As VinPrint = New VinPrint
        Dim SQLDM As New DataManager.SqlServerDataManager
        Dim DTable As New DataTable

        DTable = SQLDM.GetDataTable("Select TABDNO 'Bodynumber' ,TAEGMD+ '    ' + TAEGNO 'Engine',TAKEYN 'KEY',JCEXTC 'Color',JCGWMI+JCGVDS+TAFRSQ + '~' + TAPRDM 'VIN' from F91TAF join F91JCF on TABDNO=JCBDNO where JCBDNO='" & Bodynumber & "'")



        If DTable.Rows.Count > 0 Then
            Try

                ' System.Diagnostics.Debugger.Break()

                crReportDocument.SetParameterValue("Body", DTable.Rows(0).Item("Bodynumber"))
                crReportDocument.SetParameterValue("Engine", DTable.Rows(0).Item("Engine"))
                crReportDocument.SetParameterValue("Key", DTable.Rows(0).Item("KEY"))
                crReportDocument.SetParameterValue("Ecol", DTable.Rows(0).Item("Color"))
                crReportDocument.SetParameterValue("Vin", DTable.Rows(0).Item("VIN"))
                crReportDocument.SetParameterValue("suf", "TS")
                ' crReportDocument.SetParameterValue("Body", DTable.Rows(0).Item("Suf"))

                crReportDocument.Load()

                crReportDocument.PrintToPrinter(1, False, 1, 1)

                         
               'doing some SQL operations on successful printing.


            Catch ex As Exception
                WriteToLogFile("Error while Printing  " & ex.Message)
            End Try


        End If





In the line "     crReportDocument.PrintToPrinter(1, False, 1, 1)" i get error Missing parameter values.

In Crystal report i have total 6 parameters.

Where am i going wrong please let me know the solution.

ASKER CERTIFIED SOLUTION
Andrew Crofts

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros