locked
Blank report displayed on certain parameter selections. RRS feed

  • Question

  • User-1670939837 posted

    I have a crystal report that generates data for any day based on date selection. However for certain date selections the report is blank even if data is present. When I debug the application the report displays correctly for that date but doesn't display when its hosted on the server.

    For example it has been displaying data properly till 15-06-2015, but thereafter till 21-06-2015, nothing is displayed and again displays the report properly from 22-06-2015. This report displays just the table shell without any data, if no data is present, but in this case an empty page is displayed.

    I have a strongly typed dataset 'customreport'

    Dim myds As New customreport
    myds.EnforceConstraints = False
    Dim rpt As New ReportDocument
    rpt.Load(Server.MapPath("receiptregister.rpt"))
    da.Fill(myds, "customreport1")
    rpt.SetDataSource(myds)
    rpt.SetParameterValue(0, dtparam)
    rpt.SetParameterValue(1, Session("OfficeName"))
    CrystalReportViewer1.ReportSource = rpt
    CrystalReportViewer1.DataBind()
    Dim oStream As MemoryStream
    oStream = CType(rpt.ExportToStream(ExportFormatType.PortableDocFormat), MemoryStream)
    Response.Clear()
    Response.Buffer = True
    Response.ContentType = "application/pdf"
    Response.BinaryWrite(oStream.ToArray())            

    Here is a screenshot for references http://prntscr.com/7ju965

    I'm at my wits end. Please help!

    Monday, June 22, 2015 2:55 AM

Answers

  • User-1670939837 posted

    Found the error. It had to do with a date in the report. All dates before the 12th of every month works fine, but after that crystal report cannot parse the dates because of dd/MM/yyyy - MM/dd/yyyy conflict. I had converted the dates in my query to dd/MM/yyyy format but in the report I again set the object format to dd/MM/yyyy, so a double formatting occurs and creates and exception.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 22, 2015 6:07 AM