MicrosoftReportViewer control is used to generate report.
Steps to generate report using MicrosoftReportViewer
Drag and Drop MicrosoftReportViewer
Drag and Drop ObjectDataSource
Now click on the Design a new report task which open Report Wizard window as shown in the figure.
Click Next
Click new connection
Select your server name, select Sql Server Authentication and enter username & password and select your database name then click OK
Click next
Click yes
Click Next
Click Finish
Click Next
Click Next
Click details until available fields not null
Click Next
Click Next
Click Next
Click Finish
Click Configure Data Source
Click Next
Click Finish
Now choose report from ReportViewer Tasks
Now execute
Generated Code:
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
Font-Size="8pt" Height="400px" Width="400px">
<LocalReport ReportPath="Report1.rdlc">
<DataSources>
<rsweb:ReportDataSource DataSourceId="ObjectDataSource1"
Name="myDataSet_insert_reg" />
</DataSources>
</LocalReport>
</rsweb:ReportViewer>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="myDataSetTableAdapters.insert_regTableAdapter">
</asp:ObjectDataSource>
Leave Comment