Tuesday, March 5, 2013

How to create report in rdlc


How to create RDLC Report in C#

RDLC - Report Definition Language Client-Side

Step 1: In Solution Explorer - right click on add select new item. Select Report wizard with name like "report1.rdlc".




Step 2: In Solution Explorer - right click on add select new item. Select DataSet.



DataSet designer window is display. Right click on it and add Table Adapter.



Now Table Adapter Configuration window is display. Click on New Connection



Add Connection window is display. Now
  • Server Name- Fill your server name
  • Log on to the Server - Click on "Use SQL Server Authentication" and fill your username and password.
  • Connect to a database - select your database name.
  • Test Connection - click on it. If test connection is succeeded, then click on OK.
Click Next then select use SQL statements radio button and click next.

 
Click on Query Builder and add Table and close. There is an option of Execute Query. So use that to execute your query.

Finally, connection string is added on app.config file.

Step 3: Now, on your report1.rdlc, add datasource then Arrange Fields window is display then Drag and drop fields accordingly


Click Next and see the preview . Choose layout and style accordingly. And then click on finish.

Step 4: Add a Window Form, Form the toolbox select reporting and add Report Viewer on it.



Choose Report - Add your report "report1.rlc"
Choose Data Source - Add data source

then click on next and finish.

Now Run your application.

No comments:

Post a Comment