We help IT Professionals succeed at work.

Connect Crystal Report to a DataSource

6,574 Views
Last Modified: 2013-11-26
I'm binding a Crystal Report Source to a SQLDataSource(SqlDataSource1) by a button click like;

    DataView dvEnc = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
    CrystalReportSource1ReportDocument.SetDataSource(dvEnc.Table);

From that poing no problem. The CrystalReportViewer show the report.

But before this operation The Crystal Report runs it's SQL queries and shows wrong data and this slows the pageload. I don't want this happen so I tried to set the datasource(empty one) of CrystalReportSource on Page Init  like;
......Page_Init(..)
{
CrystalReportSource1.ReportDocument.SetDataSource(new DataTable("EmptyDataTable"));
}
so it's ok no data will be displayed but after I clicked the button, the code in button click work but the CrystalReportViewer don't show any data.
If necessary, I'm using Visual Studio.Net 2005, Asp.Net with C# and the Crystal Report that comes with
VS 2005.
Thanks,
Comment
Watch Question

Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
What is the rest of the code you ar eusing?

mlmcc
Umut ŞekerSoftware & SQL Server
CERTIFIED EXPERT

Author

Commented:
In fact I'm using developer Express Tool called ASPxPageControl. In first tabPage, the last user enters the filter data then when clicks the button on this tabPage the report tabPage comes. T he hole code is like;
        try
        {
            DateTime test;
            test = Convert.ToDateTime(edt_Tarih_Bas.Text);
            test = Convert.ToDateTime(edt_Tarih_Bit.Text);
            lbl_Hata.Visible = false;
            Session.Add("R_ARACKONTROLFORM_NAKLIYECIKODU", edt_NAKLIYECIKODU.Text.Trim());
            Session.Add("R_ARACKONTROLFORM_BASTAR", Convert.ToDateTime(edt_Tarih_Bas.Text.Trim()));
            Session.Add("R_ARACKONTROLFORM_BITTAR", Convert.ToDateTime(edt_Tarih_Bit.Text.Trim()));
            Session.Add("R_ARACKONTROLFORM_NAKLIYECIARACPARKID", reh_NAKLIYECIARACPARKADI.popupHiddenField.Value);
                         
            ASPxPageControl1.ActiveTabIndex = 1;

            DataView dvEnc = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
            CrystalReportSource1ReportDocument.SetDataSource(dvEnc.Table);
        }
 
Umut ŞekerSoftware & SQL Server
CERTIFIED EXPERT

Author

Commented:
I want to ask one addition question,
I have built some report with CR in my web site project. But when I publishing it, it wanted the Crystal Reports 9 .NET Redistribution package. I downloaded the file from http://support.businessobjects.com/communityCS/FilesAndUpdates/cr9netredist.zip.asp
but the cr9netredist.msi file needs 19-digit keycode supplied with the product. But I don't have a product, I just use the VS.Net's Cyrstal Report. Do I have to buy Crystal Reports to install a server? Isn't it free of charge?
Umut ŞekerSoftware & SQL Server
CERTIFIED EXPERT

Author

Commented:
The Error Message is;

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: Could not load file or assembly 'CrystalDecisions.ReportAppServer.ClientDoc, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. Sistem belirtilen dosyay1 bulam1yor.

Source Error:


Line 52:                         <add assembly="CrystalDecisions.Shared, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
Line 53:                         <add assembly="CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
Line 54:                         <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
Line 55:                         <add assembly="CrystalDecisions.Enterprise.Framework, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>


Source File: c:\inetpub\wwwroot\.....\web.config    Line: 54

Assembly Load Trace: The following information can be helpful to determine why the assembly 'CrystalDecisions.ReportAppServer.ClientDoc, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' could not be loaded.


WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

 
Senior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Umut ŞekerSoftware & SQL Server
CERTIFIED EXPERT

Author

Commented:
Hi mlmcc,
Thanks for your answer I'll check in a moment. Could you answer my first question? Let me type again;

In fact I'm using developer Express Tool called ASPxPageControl. In first tabPage, the last user enters the filter data then when clicks the button on this tabPage the report tabPage comes. T he hole code is like;
        try
        {
            DateTime test;
            test = Convert.ToDateTime(edt_Tarih_Bas.Text);
            test = Convert.ToDateTime(edt_Tarih_Bit.Text);
            lbl_Hata.Visible = false;
            Session.Add("R_ARACKONTROLFORM_NAKLIYECIKODU", edt_NAKLIYECIKODU.Text.Trim());
            Session.Add("R_ARACKONTROLFORM_BASTAR", Convert.ToDateTime(edt_Tarih_Bas.Text.Trim()));
            Session.Add("R_ARACKONTROLFORM_BITTAR", Convert.ToDateTime(edt_Tarih_Bit.Text.Trim()));
            Session.Add("R_ARACKONTROLFORM_NAKLIYECIARACPARKID", reh_NAKLIYECIARACPARKADI.popupHiddenField.Value);
                         
            ASPxPageControl1.ActiveTabIndex = 1;

            DataView dvEnc = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
            CrystalReportSource1ReportDocument.SetDataSource(dvEnc.Table);
        }
 
Mike McCrackenSenior Consultant
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2013

Commented:
SOrry, I don't know enough about your tool or ASP to really answer the question.

mlmcc
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.