473,386 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Missing the benefit of DataSets with Crystal 10 with process reload on Next|Previous button activiation

Good afternoon all,

I guess I am missing the benefit of using datasets with Crystal. For
years I have written wrapper apps that used the Pull method and I let
Crystal do all the sql work. Now I have an issue where the queries run
for 4+ minutes so I don't want Crystal doing repeated legwork.

I was under the impression that once the DataSet is filled and bound to
the report the report (crystalviewer) would not need to re-run the
query - thus speeding up paging and such.

The way I have my code set up now, following the scores of examples,
everytime I hit the Next|Previous button in the CrystalViewer the code
is regenerated and the dataset is filled, and the crystalviewer is
assigned and the report takes the same amount of time to move to the
next page as it did on its initial load. I have confirmed that the
acquiring of information and modifying of sql querries on the fly is
working so I am happy with the dataset process itself but I am
dissappointed in the way it is supposedly implemented.

All of the sample code I have seen states to put the dataset and report
object code at the following:

"After the call to InitializeComponent() in PageInit()"

When I put my code inside PageInit() it is called repeatedly whenever
the Next|Previous button is selected. I've tried installing the code
inside the Page_Load() method but it too is called every time the
Next|Previous button is called.

Am I wrong in my believing that this process of creating a dataset,
filling it, assigning it using SetDataSource() method is unneccessary
and detrimental to performance?

Could someone please steer me in the right direction on this - I
believe it is a matter of placing my code in the proper place or
processing the Next|Previous response differently to avoid rebuilding
the report and re-running the dataset build.

Dave
CODE:

override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);

// If we have an error in that the report template name is
// set to "error.rpt" then DON'T try to set parameter or connection
info.
if( this.reportDocument1.FileName.IndexOf("error.rpt") == -1 )
{
if( this.reportDocument1.Subreports.Count > 0 )
setsubreportparaminfo();
setvieweroptions();
}

// set up connection information
string myConnString = "Server="
+ cfgFile.getserver().Trim()
+ ";Trusted_Connection=no" // + cfgFile.getconntype().Trim()
+ ";Database=" + cfgFile.getdatabase().Trim()
+ ";UID=" + HttpContext.Current.Session["UserID"]
+ ";PWD=" + HttpContext.Current.Session["Password"];

SqlConnection sqlConn = new SqlConnection(myConnString);

SqlDataAdapter dataAdapter = new SqlDataAdapter();

dataAdapter.SelectCommand = new SqlCommand(this.buildQuery(),
sqlConn);

DataSet dataSet = new DataSet();

// Connect to, fetch data, and disconnect from database
int rowcount = dataAdapter.Fill (dataSet);

// Use Report Engine object model to pass
// populated dataset to report
this.reportDocument1.SetDataSource (dataSet);

setparaminfo( this.reportDocument1 );
this.CrystalReportViewer1.ReportSource = this.reportDocument1;
}

May 31 '06 #1
3 1776
Try caching your dataset .. then hand back the dataset when it asks for it
again.

your code would then become.

if(!Cache.Contains("my data")) {
Cache["mydata"] = GetMyDataSet();
}
return Cache["mydata"];

This should speed you up immensely.

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"dekern" <d_******@hotmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
Good afternoon all,

I guess I am missing the benefit of using datasets with Crystal. For
years I have written wrapper apps that used the Pull method and I let
Crystal do all the sql work. Now I have an issue where the queries run
for 4+ minutes so I don't want Crystal doing repeated legwork.

I was under the impression that once the DataSet is filled and bound to
the report the report (crystalviewer) would not need to re-run the
query - thus speeding up paging and such.

The way I have my code set up now, following the scores of examples,
everytime I hit the Next|Previous button in the CrystalViewer the code
is regenerated and the dataset is filled, and the crystalviewer is
assigned and the report takes the same amount of time to move to the
next page as it did on its initial load. I have confirmed that the
acquiring of information and modifying of sql querries on the fly is
working so I am happy with the dataset process itself but I am
dissappointed in the way it is supposedly implemented.

All of the sample code I have seen states to put the dataset and report
object code at the following:

"After the call to InitializeComponent() in PageInit()"

When I put my code inside PageInit() it is called repeatedly whenever
the Next|Previous button is selected. I've tried installing the code
inside the Page_Load() method but it too is called every time the
Next|Previous button is called.

Am I wrong in my believing that this process of creating a dataset,
filling it, assigning it using SetDataSource() method is unneccessary
and detrimental to performance?

Could someone please steer me in the right direction on this - I
believe it is a matter of placing my code in the proper place or
processing the Next|Previous response differently to avoid rebuilding
the report and re-running the dataset build.

Dave
CODE:

override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);

// If we have an error in that the report template name is
// set to "error.rpt" then DON'T try to set parameter or connection
info.
if( this.reportDocument1.FileName.IndexOf("error.rpt") == -1 )
{
if( this.reportDocument1.Subreports.Count > 0 )
setsubreportparaminfo();
setvieweroptions();
}

// set up connection information
string myConnString = "Server="
+ cfgFile.getserver().Trim()
+ ";Trusted_Connection=no" // + cfgFile.getconntype().Trim()
+ ";Database=" + cfgFile.getdatabase().Trim()
+ ";UID=" + HttpContext.Current.Session["UserID"]
+ ";PWD=" + HttpContext.Current.Session["Password"];

SqlConnection sqlConn = new SqlConnection(myConnString);

SqlDataAdapter dataAdapter = new SqlDataAdapter();

dataAdapter.SelectCommand = new SqlCommand(this.buildQuery(),
sqlConn);

DataSet dataSet = new DataSet();

// Connect to, fetch data, and disconnect from database
int rowcount = dataAdapter.Fill (dataSet);

// Use Report Engine object model to pass
// populated dataset to report
this.reportDocument1.SetDataSource (dataSet);

setparaminfo( this.reportDocument1 );
this.CrystalReportViewer1.ReportSource = this.reportDocument1;
}

May 31 '06 #2
Thanks for the response Greg.

So just where would I place this code?, as the first line in the
OnInit() method?

Dave
Greg Young wrote:
Try caching your dataset .. then hand back the dataset when it asks for it
again.

your code would then become.

if(!Cache.Contains("my data")) {
Cache["mydata"] = GetMyDataSet();
}
return Cache["mydata"];

This should speed you up immensely.

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"dekern" <d_******@hotmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
Good afternoon all,

I guess I am missing the benefit of using datasets with Crystal. For
years I have written wrapper apps that used the Pull method and I let
Crystal do all the sql work. Now I have an issue where the queries run
for 4+ minutes so I don't want Crystal doing repeated legwork.

I was under the impression that once the DataSet is filled and bound to
the report the report (crystalviewer) would not need to re-run the
query - thus speeding up paging and such.

The way I have my code set up now, following the scores of examples,
everytime I hit the Next|Previous button in the CrystalViewer the code
is regenerated and the dataset is filled, and the crystalviewer is
assigned and the report takes the same amount of time to move to the
next page as it did on its initial load. I have confirmed that the
acquiring of information and modifying of sql querries on the fly is
working so I am happy with the dataset process itself but I am
dissappointed in the way it is supposedly implemented.

All of the sample code I have seen states to put the dataset and report
object code at the following:

"After the call to InitializeComponent() in PageInit()"

When I put my code inside PageInit() it is called repeatedly whenever
the Next|Previous button is selected. I've tried installing the code
inside the Page_Load() method but it too is called every time the
Next|Previous button is called.

Am I wrong in my believing that this process of creating a dataset,
filling it, assigning it using SetDataSource() method is unneccessary
and detrimental to performance?

Could someone please steer me in the right direction on this - I
believe it is a matter of placing my code in the proper place or
processing the Next|Previous response differently to avoid rebuilding
the report and re-running the dataset build.

Dave
CODE:

override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);

// If we have an error in that the report template name is
// set to "error.rpt" then DON'T try to set parameter or connection
info.
if( this.reportDocument1.FileName.IndexOf("error.rpt") == -1 )
{
if( this.reportDocument1.Subreports.Count > 0 )
setsubreportparaminfo();
setvieweroptions();
}

// set up connection information
string myConnString = "Server="
+ cfgFile.getserver().Trim()
+ ";Trusted_Connection=no" // + cfgFile.getconntype().Trim()
+ ";Database=" + cfgFile.getdatabase().Trim()
+ ";UID=" + HttpContext.Current.Session["UserID"]
+ ";PWD=" + HttpContext.Current.Session["Password"];

SqlConnection sqlConn = new SqlConnection(myConnString);

SqlDataAdapter dataAdapter = new SqlDataAdapter();

dataAdapter.SelectCommand = new SqlCommand(this.buildQuery(),
sqlConn);

DataSet dataSet = new DataSet();

// Connect to, fetch data, and disconnect from database
int rowcount = dataAdapter.Fill (dataSet);

// Use Report Engine object model to pass
// populated dataset to report
this.reportDocument1.SetDataSource (dataSet);

setparaminfo( this.reportDocument1 );
this.CrystalReportViewer1.ReportSource = this.reportDocument1;
}


Jun 1 '06 #3
Yes in your oninit method ..

"dekern" <d_******@hotmail.com> wrote in message
news:11**********************@y43g2000cwc.googlegr oups.com...
Thanks for the response Greg.

So just where would I place this code?, as the first line in the
OnInit() method?

Dave
Greg Young wrote:
Try caching your dataset .. then hand back the dataset when it asks for
it
again.

your code would then become.

if(!Cache.Contains("my data")) {
Cache["mydata"] = GetMyDataSet();
}
return Cache["mydata"];

This should speed you up immensely.

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung
"dekern" <d_******@hotmail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
> Good afternoon all,
>
> I guess I am missing the benefit of using datasets with Crystal. For
> years I have written wrapper apps that used the Pull method and I let
> Crystal do all the sql work. Now I have an issue where the queries run
> for 4+ minutes so I don't want Crystal doing repeated legwork.
>
> I was under the impression that once the DataSet is filled and bound to
> the report the report (crystalviewer) would not need to re-run the
> query - thus speeding up paging and such.
>
> The way I have my code set up now, following the scores of examples,
> everytime I hit the Next|Previous button in the CrystalViewer the code
> is regenerated and the dataset is filled, and the crystalviewer is
> assigned and the report takes the same amount of time to move to the
> next page as it did on its initial load. I have confirmed that the
> acquiring of information and modifying of sql querries on the fly is
> working so I am happy with the dataset process itself but I am
> dissappointed in the way it is supposedly implemented.
>
> All of the sample code I have seen states to put the dataset and report
> object code at the following:
>
> "After the call to InitializeComponent() in PageInit()"
>
> When I put my code inside PageInit() it is called repeatedly whenever
> the Next|Previous button is selected. I've tried installing the code
> inside the Page_Load() method but it too is called every time the
> Next|Previous button is called.
>
> Am I wrong in my believing that this process of creating a dataset,
> filling it, assigning it using SetDataSource() method is unneccessary
> and detrimental to performance?
>
> Could someone please steer me in the right direction on this - I
> believe it is a matter of placing my code in the proper place or
> processing the Next|Previous response differently to avoid rebuilding
> the report and re-running the dataset build.
>
> Dave
>
>
> CODE:
>
> override protected void OnInit(EventArgs e)
> {
> InitializeComponent();
> base.OnInit(e);
>
> // If we have an error in that the report template name is
> // set to "error.rpt" then DON'T try to set parameter or connection
> info.
> if( this.reportDocument1.FileName.IndexOf("error.rpt") == -1 )
> {
> if( this.reportDocument1.Subreports.Count > 0 )
> setsubreportparaminfo();
> setvieweroptions();
> }
>
> // set up connection information
> string myConnString = "Server="
> + cfgFile.getserver().Trim()
> + ";Trusted_Connection=no" // + cfgFile.getconntype().Trim()
> + ";Database=" + cfgFile.getdatabase().Trim()
> + ";UID=" + HttpContext.Current.Session["UserID"]
> + ";PWD=" + HttpContext.Current.Session["Password"];
>
> SqlConnection sqlConn = new SqlConnection(myConnString);
>
> SqlDataAdapter dataAdapter = new SqlDataAdapter();
>
> dataAdapter.SelectCommand = new SqlCommand(this.buildQuery(),
> sqlConn);
>
> DataSet dataSet = new DataSet();
>
> // Connect to, fetch data, and disconnect from database
> int rowcount = dataAdapter.Fill (dataSet);
>
> // Use Report Engine object model to pass
> // populated dataset to report
> this.reportDocument1.SetDataSource (dataSet);
>
> setparaminfo( this.reportDocument1 );
> this.CrystalReportViewer1.ReportSource = this.reportDocument1;
> }
>

Jun 1 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Dr. Indera | last post by:
hello, i previously posted the questions below on several crystal reports newsgroups, including the one for the company that makes crystal reports, but never got an answer, so i'm hoping that...
0
by: cycloneboy | last post by:
When I call a crystal report via a hyperlink the report runs great. If I click the BACK button on the browser and then click the hyperlink to call the report again I get...
2
by: Darrin | last post by:
Hello, I am looking for a web reporting solution. I have researched some things on crystal reports but read that the version that is bundled with Visual Studio 2003 does not allow you to print...
4
by: N. Demos | last post by:
Hello, I'm learning ASP.NET, and am having a strange problem with some example code from the book I'm using. The code increments and displays the value stored in a session variable when the "Add"...
6
by: Stefan Mueller | last post by:
After my web page has been loaded I'm doing some tests with a JavaScript. If I figure out that something is wrong I'd like to reload the whole frameset. With Internet Explorer and Mozilla Firefox...
1
by: steveberwick | last post by:
**Using Visual Studio 2005 and Crystal Reports XI Release 2 Developer Edition. I currently have a multi-threaded C# application that loads a Crystal Report at runtime, fills out the necessary...
8
by: GaryDean | last post by:
I have a Wizard page and need to affect the next and previous buttons from my code-behind. I've googled around and found two solutions, and neither appear to work. I can access the SideBarList...
6
by: Miro | last post by:
I can run an exe ( and its install ) i have created on my machine. The exe has a button that populates a dataset and then shoots it to a crystal report. But... Installing the setup.exe on my...
4
by: Miro | last post by:
<i have also added this reply to the other newsgroup - now that I have realizd ( and assuming ) it is not a localized error directly to vb.> I have found this link on the website:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.