Program Crashes while using crystal report
I am using Crystal Report Version No.: 11.0.0.1282
My program crashes when I run following lines of code.
I have created a connection with SQL server database through DSN. I have used following lines of code…
1 StrSQL= “SELECT Employee.EmpNo, Employee.Name, Employee.Address, EmpSalary.Salary FROM Testing.dbo.Employee Employee LEFT OUTER JOIN Testing.dbo.EmpSalary EmpSalary ON Employee.EmpNo=EmpSalary.EmpNo"
2 Set rpt = cryApp.OpenReport(“C:\EmpDetails.RPT")
3 Call Open_RecordSet(StrSQL) ‘assigns recordset value to rs
4 rpt.DiscardSavedData
5 rpt.Database.LogOnServer "crdb_odbc.dll", "DSN", "Database", "uid", "pwd"
6 rpt.Database.SetDataSource rs
7 FrmCrystal.cryreportviewer1.ReportSource = rpt
8 FrmCrystal.cryreportviewer1.ViewReport
9 FrmCrystal.Show vbModal
10 Set FrmCrystal = Nothing
11 rpt.Database.LogOffServer "crdb_odbc.dll", "DSN", "Database", "uid", "pwd"
12 Set rpt = Nothing
I am getting error when line No. 12 is executed. Program crashes and gives following error message...
Program.EXE has encountered a problem and needs to close. We are sorry for the inconvenience.
I have tested various combinations. I have concluded that the error comes when following two conditions meet,
1) Statement No.5 exists in above code.
AND
2) Crystal Report contains field from two different tables.
AND
3) Line No 12 is executed.
:confused:
Re: Program Crashes while using crystal report
Welcome to the forums. :wave:
Is this happening on your developer machine or a machine where you have installed your application?
Re: Program Crashes while using crystal report
This is happening on my testing machine. This is my desktop application and I am just checking on my desktop after creating it. Please help me as soon as possible. Thanks.