Use Crystal Reports (medium) in ASP. NET)

Source: Internet
Author: User
Use the PULL mode

We will use the following steps to execute the Crystal Report in PULL mode.

1. Create an rpt file and use the crystal report design interface to set some required data connections.

2. Drag and Drop a crystalreportviewer control to the ASPX page and set its properties to specify the. rpt file we created in the previous step.

3. Call the databind method in the code.

Create a. rpt file:

1) Right-click "Solution Explorer" and select "add" -- "Add new item" --> "Crystal Report" in the pop-up menu"

2) Select "blank report" from "Crystal Report library" and click "OK".

3) The Crystal Report designer is displayed.

4) Right-click "details area" in the report and choose "Database"> "Add/delete database ..."

5) in the pop-up "Database Expert", expand the "ole db (ADO)" option. Another "ole db (ADO)" window will pop up.

6) in the "ole db (ADO)" pop-up window, select "Microsoft ole db provider for SQL Server" and then "Next"

7) Specify the connection information

Server: aspcn (name of your machine)
User ID: SA
Password:
Database: pubs

8) Click "Next" and then click "finish.

9) Then you can see the selected database in the Database Expert window.

10) Expand "pubs" database, expand "table", select "stores" table and add it to the "selected table" area, and click "OK.

 

11) now, in the "field resource Browser", the selected table and fields in the table are displayed in the "database Field" area on the left.

12) drag and drop the required fields to the "details" Area of the report. The field name automatically appears in the "Header" area. If you want to modify the header text, right-click the text in the "Header" area, select the "edit text object" option, and edit it.

13) Save, so we have a crystal report file.

Create the crystalreportviewer Control

14) return to the front webform and drag a crystal report viewer control to the page.

15) in the Properties window of the Crystal Report viewer control, select "databindings" and click [...].

16) in the "Crystal Report viewer Data Binding window", select "reportsource" in "binable attributes" on the right, and select the custom binding expression in the lower right corner. rpt file path.

17) in this case, you can view the preview of a report file composed of some virtual data in the Crystal Report viewer control.

Note: In the preceding example, crystalreportviewer can directly call real data during design because the data has been saved. In this case, data cannot be displayed when no data is saved during design. In this case, some virtual data is displayed, and only real data is selected during execution.

Code behind Programming

18) Call the databind method in the page_load method.

Execute your program

19) Create and run your program!

You can now directly use some built-in functions of the Crystal Report on the web page, such as page navigation and scaling.

We will use the following steps to execute the Crystal Report in PULL mode.

1. Create an rpt file and use the crystal report design interface to set some required data connections.

2. Drag and Drop a crystalreportviewer control to the ASPX page and set its properties to specify the. rpt file we created in the previous step.

3. Call the databind method in the code.

Create a. rpt file:

1) Right-click "Solution Explorer" and select "add" -- "Add new item" --> "Crystal Report" in the pop-up menu"

2) Select "blank report" from "Crystal Report library" and click "OK".

3) The Crystal Report designer is displayed.

4) Right-click "details area" in the report and choose "Database"> "Add/delete database ..."

5) in the pop-up "Database Expert", expand the "ole db (ADO)" option. Another "ole db (ADO)" window will pop up.

6) in the "ole db (ADO)" pop-up window, select "Microsoft ole db provider for SQL Server" and then "Next"

7) Specify the connection information

Server: aspcn (name of your machine)
User ID: SA
Password:
Database: pubs

8) Click "Next" and then click "finish.

9) Then you can see the selected database in the Database Expert window.

10) Expand "pubs" database, expand "table", select "stores" table and add it to the "selected table" area, and click "OK.

 

11) now, in the "field resource Browser", the selected table and fields in the table are displayed in the "database Field" area on the left.

12) drag and drop the required fields to the "details" Area of the report. The field name automatically appears in the "Header" area. If you want to modify the header text, right-click the text in the "Header" area, select the "edit text object" option, and edit it.

13) Save, so we have a crystal report file.

Create the crystalreportviewer Control

14) return to the front webform and drag a crystal report viewer control to the page.

15) in the Properties window of the Crystal Report viewer control, select "databindings" and click [...].

16) in the "Crystal Report viewer Data Binding window", select "reportsource" in "binable attributes" on the right, and select the custom binding expression in the lower right corner. rpt file path.

17) in this case, you can view the preview of a report file composed of some virtual data in the Crystal Report viewer control.

Note: In the preceding example, crystalreportviewer can directly call real data during design because the data has been saved. In this case, data cannot be displayed when no data is saved during design. In this case, some virtual data is displayed, and only real data is selected during execution.

Code behind Programming

18) Call the databind method in the page_load method.

Execute your program

19) Create and run your program!

You can now directly use some built-in functions of the Crystal Report on the web page, such as page navigation and scaling.

We will use the following steps to execute the Crystal Report in PULL mode.

1. Create an rpt file and use the crystal report design interface to set some required data connections.

2. Drag and Drop a crystalreportviewer control to the ASPX page and set its properties to specify the. rpt file we created in the previous step.

3. Call the databind method in the code.

Create a. rpt file:

1) Right-click "Solution Explorer" and select "add" -- "Add new item" --> "Crystal Report" in the pop-up menu"

2) Select "blank report" from "Crystal Report library" and click "OK".

3) The Crystal Report designer is displayed.

4) Right-click "details area" in the report and choose "Database"> "Add/delete database ..."

5) in the pop-up "Database Expert", expand the "ole db (ADO)" option. Another "ole db (ADO)" window will pop up.

6) in the "ole db (ADO)" pop-up window, select "Microsoft ole db provider for SQL Server" and then "Next"

7) Specify the connection information

Server: aspcn (name of your machine)
User ID: SA
Password:
Database: pubs

8) Click "Next" and then click "finish.

9) Then you can see the selected database in the Database Expert window.

10) Expand "pubs" database, expand "table", select "stores" table and add it to the "selected table" area, and click "OK.

 

11) now, in the "field resource Browser", the selected table and fields in the table are displayed in the "database Field" area on the left.

12) drag and drop the required fields to the "details" Area of the report. The field name automatically appears in the "Header" area. If you want to modify the header text, right-click the text in the "Header" area, select the "edit text object" option, and edit it.

13) Save, so we have a crystal report file.

Create the crystalreportviewer Control

14) return to the front webform and drag a crystal report viewer control to the page.

15) in the Properties window of the Crystal Report viewer control, select "databindings" and click [...].

16) in the "Crystal Report viewer Data Binding window", select "reportsource" in "binable attributes" on the right, and select the custom binding expression in the lower right corner. rpt file path.

17) in this case, you can view the preview of a report file composed of some virtual data in the Crystal Report viewer control.

Note: In the preceding example, crystalreportviewer can directly call real data during design because the data has been saved. In this case, data cannot be displayed when no data is saved during design. In this case, some virtual data is displayed, and only real data is selected during execution.

Code behind Programming

18) Call the databind method in the page_load method.

Execute your program

19) Create and run your program!

You can now directly use some built-in functions of the Crystal Report on the web page, such as page navigation and scaling.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.