Skip to Content
0
Former Member
May 11, 2011 at 05:55 PM

SetDataSource running slowly the first time

91 Views

Hi,

I have a report that has a main dataset and then 4 datasets that fill subreports. When I fill the main dataset using SetDataSource it takes around 20 seconds but each subsequent SetDataSource runs quicker (when filling the subreports). The first SetDataSource fills more fields (around 35), but it's only 1 record whereas the other datasets fill less fields but have multiple records. If I run the same report again after the first try then sometimes it's quicker and others it's not. I'm not sure what might be causing this and can't find any answers online. The report has been made in Crystal Reports 2008. Below is what the code leading up to the SetDataSource looks like.

Report = New BOL_Final

p_sql = "SQL CODE HERE"

' get_cr_rs uses an OleDbDataAdapter Fill function to pull the data in from the database (SQL Server 2005)
' p_sql has the SQL Code, "tbl_bol" is the name of the dataset inside the .xsd file
p_sys_dataset(0) = get_cr_rs(p_sql, "tbl_bol")

Report.SetDataSource(p_sys_dataset(0))

If any more information is needed just let me know and thanks for any help!

Tim