Results 1 to 3 of 3

Thread: Program Crashes while using crystal report

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2008
    Posts
    2

    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.

    Last edited by Smith_Will; May 9th, 2008 at 05:33 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width