How to Generate Report From SQL Server Database Using Report Wizard in ASP.NET


How to generate a report from a SQL Server database using the Report Wizard in ASP.NET.

In this article I will explain how to generate a report from a SQL Server database using the Report Wizard and display it in ASP.NET.

Introduction

In this article we will generate a report from a SQL Server database using the Report Wizard and display it in ASP.NET using MicrosoftReportViewer control.

Step 1:

RptWzrd1.jpg

Create a new ASP.NET Web Application:

Step 2:

RptWzrd2.jpg

Add a new Report Wizard using right-click on project and Add -> New Item. Click on the Add button. Click Next on the Report Wizard welcome screen.

Step 3:

RptWzrd3.jpg

Choose your Data Connection and click on Next.

Click Next which will save a connection string in the Web.config file.

Step 4:

RptWzrd4.jpg

Select tables and columns to display on the report. Then click on Finish.

Step 5:

RptWzrd5.jpg

Select the Data Source (authors in this case) and click on Next.

Step 6:

RptWzrd6.jpg

Select the Report Type, Tabular or Matrix and click on Next.

Click Next in the "Design the Table" wizard.

Step 7:

RptWzrd7.jpg

Choose the table layout, Stepped or Block and click on Next.

Step 8:

RptWzrd8.jpg

Choose a table style from the left and click on Next and then Finish.

Step 9:

We have generated our report and added it to the project. Our next step is to display this report in a web form. To display the report we will use a Microsoft ReportViewer control.

Drag a Microsoft ReportViewer control to the Default.aspx from the Toolbox. It is found under Reporting tab. Select ReportViewer Tasks button (Little arrow in Top-Right of the ReportViewer) and select "Report1.rdls" from the "Choose Report" dropdown.

RptWzrd9.jpg

Final Output:

RptWzrd10.jpg

Up Next
    Ebook Download
    View all
    Learn
    View all