Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. Why does Crystal take so long to set datasource only the first time

Why does Crystal take so long to set datasource only the first time

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpquestiondatabasesalesxml
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hypermommy
    wrote on last edited by
    #1

    Hi all, I'm trying to track down why my report takes so long to load the first time but subsequent loads are quite quick. I'm setting the datasource of the report to a dataset, but that's done every time. However, in stepping through the code, I've found that the first time I run this segment of code, it takes a few seconds for the data source to get set. But on subsequent runs it takes no longer than any other command. Any ideas? I've posted the relevant part of the code below.

    If ds.Tables(0).Rows.Count > 0 Then
    AddImageColumn(ds.Tables(0), "ClientPic")
    Dim myFilename As String
    myFilename = myG.AppLocation & "\" & myDB.DoExecScalarQuery("select picture from personal")
    If File.Exists(myG.AppLocation & "\ClientDocs\" & myG.Patient & "_clientimage.jpg") Then
    If File.Exists(myFilename) Then
    LoadImage(ds.Tables(0).Rows(0), "ClientPic", myFilename)
    End If
    ds.WriteXml(applocation & "\personal.xml")
    ds.WriteXmlSchema(myG.AppLocation & "\personal.xsd")
    'Dim rptPersonal As New crptPersonalInfo ' now declared in main
    rptPersonal.SetDataSource(ds) ' THIS IS THE LINE THAT'S SLOW THE FIRST TIME
    ' Dim rptPersonalViewer As New frmReportViewer ' now declared in main
    rptPersonalViewer.cr.ReportSource = rptPersonal
    rptPersonalViewer.ShowDialog()
    Else
    MsgBox("Please check your personal information. It appears some of it may be missing.",
    MsgBoxStyle.OkOnly, "No Data For Report")
    End If

    Catch ex As Exception
    Dim myE As New EventLogging.EventLogging
    myE.StoreEvent("frmRptParams.RunReport", "Error running report", ex.Message & vbCrLf & vbCrLf & "SQL was: " & strPersonalInfo)
    myE = Nothing
    MsgBox("There was a problem gathering data for the Personal Info report. If the problem persists please contact customer service.", MsgBoxStyle.Exclamation, "Report Not Run")
    Finally
    da = Nothing
    ds = Nothing
    End Try

    Denise "Hypermommy" Duggan

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups