Lập trình AW Ad-Hoc Reporter làm báo cáo RDL trong SQL Server 2008 R2


I. Giới thiệu về BI:

Mô hình sản phẩm nhằm thiết lập Hệ thống báo cáo báo biểu đã được Microsoft phát triển từ thập niên 90:

BIS_Production

Các sản phẩm và công nghệ BI tôi đã nghiên cứu và thiết kế trải dài hơn 13 năm qua được thể hiện:

  1. 1995: VISData 1.0
  2. 1998: VISData 1.1
  3. 2001: VASEPData 2.0
  4. 2003: PSMS Data 3.0
  5. 2004:  WCOO Customs DB 1.0
  6. 2005: VN Customs Data 3.1
  7. 2008: Spanish Customs Data 2.0
  8. 2010: VN Customs DB 4.0
  9. 2013: Global Customs BIS 2012

II. Nhận xét:

Tất cả các sản phẩm trên thành công đều dựa trên nguyên tắc sau:

  1. Công nghệ mới của Microsoft chuyên về xử lý dữ liệu.
  2. Tập trung cải tiến và phát triển các hệ thống CSDL lớn (Big Data – Data Warehouse – OLAP – Ad-Hoc Report on Web – Report Services).
  3. Học hỏi các giải pháp phân tích và lập trình bằng các ngôn ngữ dễ tích hợp trên nền SQL Business Intelligence Development Solution như VB , C#.

Mô hình xử lý dữ liệu của Microsoft hiện nay đã thay đổi mạnh mẽ và con đường công nghệ cũng đã chọn theo hướng:

image

 

III. Thông tin tham khảo:

Truy cập các trang web để tải về các ứng dụng cần thiết cho việc thiết kế ứng dụng:

  • Windows Form hoặc Web Form làm theo mô hình AW Ad-Hoc Reporter.
  • Nên chọn ứng dụng chuẩn và phù hợp với phiên bản SQL Server 2008 R2.

http://msftrsprodsamples.codeplex.com/ 

http://sqlserversamples.codeplex.com/#utilities

http://technet.microsoft.com/en-us/sqlserver/ff660783.aspx

http://archive.msdn.microsoft.com/reportviewer/Release/ProjectReleases.aspx?ReleaseId=4940

 

Source code
The book’s source code can be downloaded from Manning’s web site at http://www.manning.com/lachev.

The next sections discuss the software requirements for executing the code and the steps to set it up. Instead of partitioning the source code on a per-chapter basis, we decided to consolidate most of it in two applications: a WinForm-based AWReporterWin application and a web-based AWReporterWeb application. This approach has several advantages, including the following:

  • Simplifies the setup—For example, you need only one virtual folder to host the AWReporterWeb web application.
  • Allows the reader to launch the samples conveniently from a single application menu.
  • Simulates real-world applications—For example, you can encapsulate the code logic in a set of common classes.
    The trade-off is that you may not have all the software dependencies required to compile the sample applications and you may run into compilation errors, as explained in the next section.

SOFTWARE REQUIREMENTS
Some samples have more involved setup requirements. For example, chapter 12 requires the Office Web Components Primary Interop Assemblies (PIAs) to be installed, while chapter 13 requires the Authorization Manager (available only on Windows 2003 and Windows 2000 as a separate download) to be installed. To prevent compilation errors because of missing external dependencies, we excluded the source code for these two chapters, the AWReporterWin and AWReporterWeb projects, respectively. Please follow the setup instructions found in the readme files in the sample folders to run these samples successfully.
In case you still experience compilation errors as a result of missing external dependencies, we suggest that you resolve the issue by excluding the samples. For example, let’s say you don’t have Office 2003 and you can’t compile AWReporterWin. To fix this, right-click on the corresponding folder that contains the sample code in the Visual Studio .NET 2003 Solution Explorer and choose the Exclude from Project menu item. Then, compile the project and fix the compilation errors (if any) by commenting out any references to the excluded code.
Microsoft SQL Server 2000 Required by Reporting Services. You will need to install the AdventureWorks2000 database from the RS Setup program.

SOURCE CODE
SETTING UP THE SOURCE CODE

At this point, you should be able to run most of the reports.
Some reports require a more involved setup process. For example, there are reports that require that additional assemblies, such as AWC.RS.Extensions.dll and AWC.RS.Library.dll, be configured properly. The readme files that accompany the sample code include specific step-by-step instructions about how to configure these assemblies. Deploying the reports to the Report Server To run most of the code samples successfully, you need to deploy the sample reports
to the Report Server. Assuming that you have Administrator rights to the report catalog, the easiest way to do this is to follow these steps:

  • Step 1: Copy the AWC.RS.Library.dll and OpenForecast.dll to the Report Server  binary folder, C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin. This step is needed because some reports reference these assemblies, and the deployment process will fail if these assemblies are not found in the Report Server binary folder.
  • Step 2: If you haven’t done this already, copy the AWC.RS.Library.dll and Open-Forecast.dll to the Report Designer binary folder C:\Program Files\Microsoft SQL Server\80\Tools\Report Designer.
  • Step 3: Open the AWReporter.rptproj project (found under the Reports folder) in Visual Studio .NET 2003.
  • Step 4: Right-click the AWReporter project in the Visual Studio .NET Solution Explorer and choose Properties to open the project’s properties.
  • Step 5: Verify that the TargetFolder setting is set to AWReporter and the TargetServer-URL setting is set to http://<servername>/ReportServer, where <servername> is the computer name where the Report Server is installed. If RS is installed locally, the TargetServerURL setting should be http://localhost/ReportServer.
  • Step 6: Click the Configuration Manager button and verify that both the Build and Deploy check boxes are selected for Debug configuration. Click OK to dismiss the Property Pages dialog.
  • Step 7: Right-click the AWReporter project again and choose Deploy. This will build the reports and then deploy them to the report catalog.
  • Step 8: To verify the setup, open the Report Manager web portal. If RS is installed locally, the default Report Manager URL will be http://localhost/reports. Under the Home folder, verify that the AWReporter folder exists. Click its link and run the Sales By Territory report. If everything is okay, the report will render in the browser.

SOURCE CODE
Configuring the AWReporterWeb application

To configure the web-based samples, you need to set up the AWReporterWeb virtual folder by following these steps:

  • Step 1 Right-click the AWReporterWeb folder in Windows Explorer and choose Properties.
  • Step 2 Select the Web Sharing tab.
  • Step 3 Click the Share This Folder radio button.
  • Step 4 In the Edit Alias dialog, enter AWReporterWeb as an alias.
  • Step 5 Make sure that the Read Access Permission check box is selected and the Scripts radio button is selected. Click OK to close the Edit Alias dialog.
  • Step 6 Open the Internet Information Manager (IIS) console. Right-click the AWReporterWeb folder, choose Properties, and then select the Directory
    Security tab. Click the Edit button in the Authentication and Access Control panel. Uncheck the Enable Anonymous Access check box. Make sure that
    the Integrated Windows Authentication check box is selected.

 

RSExplorer Sample Application

 

This sample works only with SQL Server 2008 R2. It will not work with any version of SQL Server earlier than SQL Server 2008 R2.
RSExplorer is a sample Microsoft Windows application developed in Microsoft Visual C# using Microsoft Visual Studio. The application is based on a real-world scenario, and it demonstrates how to develop a Windows application that uses the Reporting Services Web service. RSExplorer uses a Microsoft .NET Framework proxy class to call Web service methods exposed by the Reporting Services SOAP API. It also highlights new features in the area of enterprise reporting. This sample is not supported on Itanium-based operating systems.

Important:

Sample applications should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.

Requirements

You should be familiar with Visual Studio and Visual Basic or C#, and you should have installed the following to use the RSExplorer sample:

  • Microsoft Visual Studio 2010.
  • SQL Server 2008 R2, including Reporting Services.
  • Microsoft .NET Framework 2.0.
  • Reporting Services samples. You can choose to install the samples during SQL Server setup. For this release, when you choose to install samples, a separate installer is installed on your computer that you can launch to extract and install samples. You can run this installer from the Start menu in the Microsoft SQL Server program group.
  • A report server that you have permission to access on your network, if you plan to use the sample client application to view the contents of a report server and render reports.

Note:

RSExplorer may be converted to compile and run in previous versions of Visual Studio. However, it is designed specifically to be compatible with the version mentioned in this section.

Important:

SQL Server samples and sample databases must be downloaded and installed before you can view or work with them. For more information, see Considerations for Installing SQL Server Samples and Sample Databases.

Location

This sample is located by default at:
C:\Program Files\Microsoft SQL Server\100\Samples\Reporting Services\Application Samples\Report Search Sample

Building the Sample

If you have not already created a strong name key file, generate the key file using the following instructions.

To generate a strong name key file
  1. Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.– or –Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.
  2. Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed. Note: To determine the folder where samples are located, click the Start* button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.*
  3. At the command prompt, run the following command to generate the key file: sn -k SampleKey.snkImportant: For more information about the strong-name key pair, see “Security Briefs: Strong Names and Security in the .NET Framework” in the .NET Development Center on MSDN.
To build and run the RSExplorer sample within Visual Studio
  1. Open the solution (RSExplorerCS.sln or RSExplorerVB.sln).
  2. From the Debug menu, click Start Without Debugging.
  3. To exit the application, choose File and then Exit.
To build and run the RSExplorer sample from the Command Line
  1. Use the Change Directory command to change to the RSExplorer directory.
  2. Type the following to build both the C# and Visual Basic versions of the sample: * for /r %f in (*.sln) do C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\msbuild.exe “%f” * Note: The Windows system path and .NET Framework version number may differ on your system.
  3. In the application’s \Bin\Debug directory, double-click RSExplorer.exe to start the application.
  4. From the File menu, choose Exit to close the application.
Using RSExplorer

After installing the RSExplorer sample application, you can use the sample to view the contents of a report server, add new folders, import reports, edit item properties, and view reports.

Important:

Sample applications should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.

To start the RSExplorer sample application
  1. Open RSExplorer.sln in Visual Studio.
  2. On the Debug menu, click Start to run the sample application.
  3. In the Server Address box, enter the virtual root of the report server you want to access for example, http://&lt;localhost>/reportserver, and then click Go. A detailed list of report server items should appear in the Catalog Explorer list view.
  4. Navigate the report server database tree by clicking on folders. You can navigate back by clicking the Up arrow on the toolbar.
  5. Click on any report in the list and click the Show Properties link to view the description and path properties.
To add a folder to the report server database
  1. Navigate to a location in the tree to which you want to add a new folder.
  2. On the File menu, click New, and then click Folder. The Add Folder dialog box opens.
  3. Choose a name and description for the folder, and then click Add.
To import a report
  1. On the File menu, click Import Report. The Import Report File dialog box opens.
  2. Use the dialog box to browse for a Report Definition Language (RDL) file that you want to upload to your report server, and then click Open.
To delete an item from the report server database
  1. Browse to and select an item that you want to delete in the Catalog Explorer list.
  2. On the Edit menu, click Delete. Click Yes to confirm the action.
To copy items in the report server database
  1. Select the item that you want to copy. RSExplorer is limited to copying reports, resources, and data sources.
  2. On the Edit menu, click Copy.
  3. Browse to a folder into which you want to copy the selected item or items, and then, on the Edit menu, click Paste.
To view the properties of a selected item
  1. Select an item in the Catalog Explorer list.
  2. Click the Show Properties link above the right window pane. The properties are displayed.

About thangletoan

Hallo Aloha

Posted on 30/07/2013, in AW AD-HOC Reporter, Công nghệ và Giáo dục, Microsoft, Microsoft Access Database, Microsoft SQL Report Server, Microsoft SQL Server, Microsoft SQL Server 2008 R2 and tagged , . Bookmark the permalink. 1 Phản hồi.

Gửi phản hồi

Mời bạn điền thông tin vào ô dưới đây hoặc kích vào một biểu tượng để đăng nhập:

WordPress.com Logo

Bạn đang bình luận bằng tài khoản WordPress.com Log Out / Thay đổi )

Twitter picture

Bạn đang bình luận bằng tài khoản Twitter Log Out / Thay đổi )

Facebook photo

Bạn đang bình luận bằng tài khoản Facebook Log Out / Thay đổi )

Google+ photo

Bạn đang bình luận bằng tài khoản Google+ Log Out / Thay đổi )

Connecting to %s

%d bloggers like this: