Avatar of Avinash Desai
Avinash Desai
Flag for India

asked on 

Crystal Report Error "Missing parameter values." while Printing

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

                ' 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.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.

Visual Basic.NETCrystal Reports

Avatar of undefined
Last Comment
Andrew Crofts

8/22/2022 - Mon