Link to home
Start Free TrialLog in
Avatar of Avinash Desai
Avinash DesaiFlag 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
            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
Avatar of Andrew Crofts
Andrew Crofts
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mike McCracken
Mike McCracken

That is one problem.

You may also need to check the parameter names.  I found in a VB6 application that the names included the { } and the ?

mlmcc