Skip to Content
0

crystal report preview is very long when run and not show anything

Nov 10, 2016 at 11:00 AM

37

avatar image

I used crystal report 11 in visual studio 2008 , I used xml schema data source ( xsd )

to set data source for my report , the Preview Report is very long and not show me

anything for 1000 rows or more than

how can I improve performance run my report when export to pdf

Page load event

ProtectedSub Page_Load(ByVal sender AsObject, ByVal e As System.EventArgs) HandlesMe.Load
Try
Dim rdoc AsNew ReportDocument
Dim ds AsNew DataSet
Dim c AsNew clsqueries
            ds = c.enqvehltimes("2016-10-01 00:00", "2016-11-01 00:00")
            ds.WriteXmlSchema(HttpContext.Current.Server.MapPath("vehlmaytime.aspx").Replace("vehlmaytime.aspx", "xsd\xvehlmt.xsd"))
Dim den AsNew DataSet
            den = c.subentpermit()
' den.WriteXmlSchema(HttpContext.Current.Server.MapPath("vehlonce.aspx").Replace("vehlonce.aspx", "xsd\xspermit.xsd"))
Dim dex AsNew DataSet
            dex = c.subexitperm()
Dim dseu AsNew DataSet
            dseu = c.subsecuser()
' dseu.WriteXmlSchema(HttpContext.Current.Server.MapPath("vehlonce.aspx").Replace("vehlonce.aspx", "xsd\xsecus.xsd"))
            rdoc.Load(HttpContext.Current.Server.MapPath("vehlmaytime.aspx").Replace("vehlmaytime.aspx", "reports\vehlsevtimes.rpt"))
            rdoc.SetDataSource(ds)
Dim sec As Section
Dim secs As Sections
Dim rob As ReportObject
Dim robs As ReportObjects
Dim subrpobj As SubreportObject
Dim subrp As ReportDocument
            secs = rdoc.ReportDefinition.Sections
ForEach sec In secs
                robs = sec.ReportObjects
ForEach rob In robs
If rob.Kind = ReportObjectKind.SubreportObject Then
                        subrpobj = CType(rob, SubreportObject)
                        subrp = subrpobj.OpenSubreport(subrpobj.SubreportName)
If subrp.Name = "entperm"Then
                            subrp.SetDataSource(den)
EndIf
If subrp.Name = "exitper"Then
                            subrp.SetDataSource(dex)
EndIf
If subrp.Name = "voutyard"Then
                            subrp.SetDataSource(dseu)
EndIf
EndIf
Next
Next
            rdoc.SetParameterValue("fdate", "2016-10-01 13:23")
            rdoc.SetParameterValue("tdate", "2016-10-01 13:24")
            Response.Write(Request.Url)
            rdoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "Vehicles entered several times")
' Crv1.ReportSource = rdoc
' Crv1.DataBind()
'ds.Dispose()
'den.Dispose()
'dex.Dispose()
'rdoc.Dispose()
'rdoc.Close()
Catch ex As Exception
            Response.Write(ex.Message)
EndTry
EndSub

and function dataset is

FriendFunction enqvehltimes(ByVal fd AsString, ByVal td AsString) As DataSet
Dim cmd AsNew SqlCommand
Dim sql AsString = " select v.vehl_VehicleID,vehl_name ,replace(r.ramp_name,'Ramp','') as rampno,n.cont_Name ,cs.Capt_US as csize,c.Comp_Name ,v.vehl_customsdec,v.vehl_customexitPermitNo ,v.vehl_CustomExitPermitDate as cexdate,v.vehl_exitdate " & _
" from   Vehicle v left outer join container n on v.vehl_vehicleid=n.cont_vehicleid left outer join Ramp r on v.vehl_rampid =r.ramp_rampid " & _
" inner join Company c on v.vehl_ClearanceCompany =c.Comp_CompanyId left outer join Custom_Captions cs on n.cont_size=cs.Capt_Code  " & _
" where  cs.Capt_Family='cont_size' and n.cont_Deleted is null And v.vehl_Deleted Is null   And r.ramp_deleted Is null" & _
" and    n.cont_Deleted is null  and v.vehl_entrancedate between  '" & fd & "' and '" & td & "' "
Dim da AsNew SqlDataAdapter
Dim con AsNew SqlConnection(Readconnectionstring())
With cmd
            .CommandText = sql
            .CommandType = CommandType.Text
            .Connection = con
            .CommandTimeout = 5
EndWith
        da.SelectCommand = cmd
Dim ds AsNew DataSet
        da.Fill(ds)
Return ds
EndFunction
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Don Williams
Apr 03, 2017 at 05:40 PM
0

What SDK are you using, CR or BOE, Service Pack etc.?

Move your code to Page_Load and use Sessions and Postback,

Search and you will find an example

Don

Share
10 |10000 characters needed characters left characters exceeded