We help IT Professionals succeed at work.

Crytal Reportd causing an untrappable error.

Hello All

Well I'm creating a VB.Net application that is using Crystal Reports everything runs fine on my development machine but when I installed it on a another computer and I go to run a report and the program generates an un-trappable error. The line that is causing the error is cryRpt.SetDataSource(DS.Tables("WorkOrder")). If anyone can see something that I'm doing wrong or offer suggestions I would greatly appreciate it. My code is below.

DC




            MsgBox("1")
            SelectCommand = WOListSelectCommand(strLimit)
            MsgBox("2")
            WODataAdapter = New OleDbDataAdapter(SelectCommand, ConString)
            MsgBox("3")
            Dim CommandBuilder As New OleDbCommandBuilder(WODataAdapter)
            MsgBox("4")
            WODataAdapter.Fill(DS, "WorkOrder")
            MsgBox("5")

            cryRpt.Load(ReportPath & "rptWOListSingle.rpt")
            MsgBox("6")
            MsgBox("Rows Found: " & DS.Tables("WorkOrder").Rows.Count.ToString)
            cryRpt.SetDataSource(DS.Tables("WorkOrder"))
            MsgBox("7")
            If OpenArgs = "WOBOARD" Then
                cryRpt.SummaryInfo.ReportTitle = "Work Order Listing"
            Else
                cryRpt.SummaryInfo.ReportTitle = "Work Order Listing for " & rTitle
            End If
            MsgBox("8")
            crParameterDiscreteValue.Value = strLimit
            crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
            crParameterFieldDefinition = crParameterFieldDefinitions.Item("Limits")
            crParameterValues = crParameterFieldDefinition.CurrentValues
            crParameterValues.Clear()
            crParameterValues.Add(crParameterDiscreteValue)
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
            MsgBox("9")

            crParameterDiscreteValue.Value = Main.qbCompanyName
            crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
            crParameterFieldDefinition = crParameterFieldDefinitions.Item("CompanyName")
            crParameterValues = crParameterFieldDefinition.CurrentValues
            crParameterValues.Clear()
            crParameterValues.Add(crParameterDiscreteValue)
            crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
            MsgBox("10")

Comment
Watch Question

Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
Did you install the appropriate run time files on the machine?

mlmcc

Author

Commented:
I have installed the runtimes files on the machine and I downloaded them from the Crystal Reports site.
Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
How many rows does it display?

mlmcc

Author

Commented:
I have set teh data up to return 1, 5, and 10 with the same result every time
Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
Is that what the msgbox for rows shows?

mlmcc

Author

Commented:
Yes that is what the msgbox shows I added that to confirm I was populating the table with data
Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
Are you running against the same database?

mlmcc

Author

Commented:
That I will have to check they are separate data files unique to each machine.
Senior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013
Commented:
Perhaps the datatypes are different.

Do you use the same query to load the dataset?
The datasets need to have the fields in the same order.

mlmcc

Author

Commented:
I have run it against the same database and it is a hard coded query so it is the same on each computer

Author

Commented:
I have also created a simple report and replaced the report that is causing the issue and I get the smae result. Any othere suggestions?

Author

Commented:
Hey mlmcc

Well I figured it out and it turnned out that i had to include then config.exe file because I had to add something for crystal reports to it to correct a file not found error.

Thank you for all of your time and effort.

DC

Explore More ContentExplore courses, solutions, and other research materials related to this topic.