Monday 28 January 2008

Crystal Reports Asp.Net issues

Deployed Crystal Reports to server by:

Run CRRedist2005_x86.msi (taken from C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\CrystalReports\)

Icons did not display in CR Toolbar:

Copy C:\Inetpub\wwwroot\aspnet_client to root of website)

 

ADO provider not found (SQL Server 2000):

Report (design-time) connection was SQL-Native changed to be SQLOLEDB.

 

Change connection information at run-time

                CrystalDecisions.Shared.TableLogOnInfo tliCurrent;
                foreach (CrystalDecisions.CrystalReports.Engine.Table tbCurrent in crSource.ReportDocument.Database.Tables)
                {
                    tliCurrent = tbCurrent.LogOnInfo;
                    tliCurrent.ConnectionInfo.ServerName = server;
                    tliCurrent.ConnectionInfo.UserID = username;
                    tliCurrent.ConnectionInfo.Password = password;
                    tliCurrent.ConnectionInfo.DatabaseName = dbname;

                    tbCurrent.ApplyLogOnInfo(tliCurrent);
                }

 

Toolbar Not working

The toolbar options were not working because a post-back was being generated that performs the functionality - the assigning of the report was within a !IsPostBack block. As the report is not held in state it must be reloaded during post back.