Use Crystal Report in asp.net (medium)

Source: Internet
Author: User
Tags header ole resource
Asp.net| Crystal Report using pull mode

We will use the following steps to execute the Crystal Report through the pull mode

1. First create the RPT file and use the Crystal Report design interface to set up some necessary data connections.

2. Drag and drop a Crystalreportviewer control to the ASPX page, set its properties to specify the. rpt file that we created in the previous step.

3. Call the DataBind method in code.

To create a. rpt file:

1 Right click on "Solution Explorer", select "Add" in the pop-up menu--"Add New Item"--> "Crystal"



2 Select the As blank Report radio button in the Crystal Reports Library, and then click OK.



3 The Crystal Report Designer will pop up here.



4) Right-click the details area in the report, select Database-> Add/Remove Database ...

5 in a pop-up database expert, expand the OLE DB (ADO) option, and an additional OLE DB (ADO) window pops 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 (what is the name of your machine?)
User Id:sa
Password:
Database: Pubs

8 Click Next, and then click Finish.

9 then you can see the database we selected in the Database Experts window.

10 Expand the Pubs database, expand Tables, select the Stores table and add it to the selected tables area, and click OK.

 

11 Now in the field resource browser, you will see the table you selected in the database fields area on the left and the fields in the table.

12 drag and drop the required fields into the details area of the report. The field name automatically appears in the header area. If you want to change the head text, you can right-click the text in the header area and select the Edit Text object option and edit it.



13 Save so we have a Crystal report file.

Creating Crystalreportviewer Controls

14) back to the front of the WebForm, drag and drop a crystal the viewer control to the page.

15 Call Crystal the Properties window of the viewer control, select "DataBindings" Area click [... ]

"Crystal" in the "List Viewer data Binding window", select "ReportSource" in bindable properties on the right, and select the. rpt file path in the lower-right corner of the custom binding expression.



17 You can now see a preview of a report file with some virtual data from the Crystal Reports Viewer control.

Note: In the above example, Crystalreportviewer can call real data directly at design time, because the data is already saved. In this case, when the data is not saved at design time, he cannot display the data. The generation of this is the display of some virtual data, only in the execution of the selection of real data.

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 use some of the built-in features of the Crystal Report, such as page navigation, scaling, and so on, directly on the Web page.


We will use the following steps to execute the Crystal Report through the pull mode

1. First create the RPT file and use the Crystal Report design interface to set up some necessary data connections.

2. Drag and drop a Crystalreportviewer control to the ASPX page, set its properties to specify the. rpt file that we created in the previous step.

3. Call the DataBind method in code.

To create a. rpt file:

1 Right click on "Solution Explorer", select "Add" in the pop-up menu--"Add New Item"--> "Crystal"



2 Select the As blank Report radio button in the Crystal Reports Library, and then click OK.



3 The Crystal Report Designer will pop up here.



4) Right-click the details area in the report, select Database-> Add/Remove Database ...

5 in a pop-up database expert, expand the OLE DB (ADO) option, and an additional OLE DB (ADO) window pops 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 (what is the name of your machine?)
User Id:sa
Password:
Database: Pubs

8 Click Next, and then click Finish.

9 then you can see the database we selected in the Database Experts window.

10 Expand the Pubs database, expand Tables, select the Stores table and add it to the selected tables area, and click OK.

 

11 Now in the field resource browser, you will see the table you selected in the database fields area on the left and the fields in the table.

12 drag and drop the required fields into the details area of the report. The field name automatically appears in the header area. If you want to change the head text, you can right-click the text in the header area and select the Edit Text object option and edit it.



13 Save so we have a Crystal report file.

Creating Crystalreportviewer Controls

14) back to the front of the WebForm, drag and drop a crystal the viewer control to the page.

15 Call Crystal the Properties window of the viewer control, select "DataBindings" Area click [... ]

"Crystal" in the "List Viewer data Binding window", select "ReportSource" in bindable properties on the right, and select the. rpt file path in the lower-right corner of the custom binding expression.



17 You can now see a preview of a report file with some virtual data from the Crystal Reports Viewer control.

Note: In the above example, Crystalreportviewer can call real data directly at design time, because the data is already saved. In this case, when the data is not saved at design time, he cannot display the data. The generation of this is the display of some virtual data, only in the execution of the selection of real data.

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 use some of the built-in features of the Crystal Report, such as page navigation, scaling, and so on, directly on the Web page.


We will use the following steps to execute the Crystal Report through the pull mode

1. First create the RPT file and use the Crystal Report design interface to set up some necessary data connections.

2. Drag and drop a Crystalreportviewer control to the ASPX page, set its properties to specify the. rpt file that we created in the previous step.

3. Call the DataBind method in code.

To create a. rpt file:

1 Right click on "Solution Explorer", select "Add" in the pop-up menu--"Add New Item"--> "Crystal"



2 Select the As blank Report radio button in the Crystal Reports Library, and then click OK.



3 The Crystal Report Designer will pop up here.



4) Right-click the details area in the report, select Database-> Add/Remove Database ...

5 in a pop-up database expert, expand the OLE DB (ADO) option, and an additional OLE DB (ADO) window pops 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 (what is the name of your machine?)
User Id:sa
Password:
Database: Pubs

8 Click Next, and then click Finish.

9 then you can see the database we selected in the Database Experts window.

10 Expand the Pubs database, expand Tables, select the Stores table and add it to the selected tables area, and click OK.

 

11 Now in the field resource browser, you will see the table you selected in the database fields area on the left and the fields in the table.

12 drag and drop the required fields into the details area of the report. The field name automatically appears in the header area. If you want to change the head text, you can right-click the text in the header area and select the Edit Text object option and edit it.



13 Save so we have a Crystal report file.

Creating Crystalreportviewer Controls

14) back to the front of the WebForm, drag and drop a crystal the viewer control to the page.

15 Call Crystal the Properties window of the viewer control, select "DataBindings" Area click [... ]

"Crystal" in the "List Viewer data Binding window", select "ReportSource" in bindable properties on the right, and select the. rpt file path in the lower-right corner of the custom binding expression.



17 You can now see a preview of a report file with some virtual data from the Crystal Reports Viewer control.

Note: In the above example, Crystalreportviewer can call real data directly at design time, because the data is already saved. In this case, when the data is not saved at design time, he cannot display the data. The generation of this is the display of some virtual data, only in the execution of the selection of real data.

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 use some of the built-in features of the Crystal Report, such as page navigation, scaling, and so on, directly on the Web page.




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.