CrystalReport学习

潘修为
2023-12-01

http://msdn.microsoft.com/en-us/library/ms227484(v=VS.90).aspx

 

参考示例要求安装Norwind数据库

 

1、找到instnwnd.sql文件

2、使用cmd进入命令提示符

3、使用osql -S serverName -U userName -P pwd -i instnwnd.sql进行安装

 

 

限定数据库访问链接的访问权限

1、创建一个新的访问账号

2、对这个账号授权

http://msdn.microsoft.com/en-us/library/ms227498(v=VS.90).aspx

 

创建WebSite项目

1、创建ASP.NET web网站

2、打开default.aspx

3、导入

 

 

4、添加一个私有的帮助方法HelperMethod

 

The ConfigureCrystalReports() method enables users to interact with the report at runtime. It also controls programmatic interaction with the report.

5、在page_init方法中调用ConfigureCystalReport方法

 

 

配置Web.config

在Default.aspx页面中,加入CrystalReportViewer,系统将自动在Web.config中添加如下内容

 

 

CrystalImageHandler

The CrystalImageHandler element displays all dynamic images in the CrystalReportViewer control. This setting configures the ASP.NET worker process to redirect requests made to CrystalImageHandler.aspx to an internal only image handler class. If you do not have the CrystalImageHandler setting in your Web.Config file, the images on your website will not show. This element is automatically added to the Web.Config file when you add the CrystalReportViewer control to your website.

 

CrystalImageCleaner

The CrystalImageCleaner process automatically deletes dynamically generated images rendered by the CrystalReportViewer control. This setting allows you to set the interval of time between scans of the image directory and the minimum age of the files before they are deleted. This element is automatically added to the Web.Config file when you add the CrystalReportViewer control to your website. This corresponds to the CrystalImageCleaner class.

  • CrystalImageCleaner-Sleep initializes the amount of time in milliseconds that the image cleaner sleeps before scanning and cleaning up image files in the dynamic image directory.
  • CrystalImageCleaner-Age initializes the minimum age in milliseconds of a file before it is deleted.
  • CrystalImageCleaner-AutoStart controls the CrystalImageCleaner process. The image cleaner cleans up the temporary images that are created when viewing a report whose value is set to true

 

printControl

The printControl element allows you to print the report directly to your local printer. By default, this control is not installed on your local machine and must be downloaded separately. You can download the PrintControl .cab file from the Business Objects technical support website: http://technicalsupport.businessobjects.com/. This setting makes the .cab file visible to your Crystal Reports.NET website. This element needs to be manually added to the Web.Config file of your website.

 

reportMappings

The reportMappings element updates websites created in Visual Studio 2003 that use embedded reports to non-embedded websites when opened in Visual Studio 2005 or later. This setting converts the .dll file created in Visual Studio 2003 to a disk file. Visual Studio 2005 and 2008 do not support embedded websites and you must modify your Web.Config file to ensure that your report is still functional with the newer version of Visual Studio. This element needs to be manually added to the Web.Config file of your website. The reportMappings setting requires an absolute path.

 

UseBrowserLocale

The UseBrowserLocale element retrieves the language settings in your browser for the CrystalReportViewer control. When set to true, this setting configures the CrystalReportViewer control to observe the browser locale. When set to false, this setting restricts the locale that is displayed page-by-page. This element needs to be manually added to the Web.Config file of your website.

 

serverFileReportManager

The serverFileReportManager element is a web service that enumerates the server files on the server machine. This setting allows you to get a list of objects (folders and reports) from a remote machine. This setting assigns the root of the file directory for the server. In this example, the root is set to c:/inetpub/wwroot. This element needs to be manually added to the Web.Config file of your website.

 

globalResourcePath

The globalResourcePath element is the reference to the file directory path for global resources. This file directory contains your custom language resources in a central location and can be shared across multiple web applications. This setting allows you to access the global resources in a specific website. In CrystalReports.NET, the default resource files are not shipped with the product install, but can be downloaded from the Business Objects technical support website:http://technicalsupport.businessobjects.com/. This element needs to be manually added to the Web.Config file of your website.

 

 

 

 

 

 

 

 类似资料: