Introduction:
In this article I will explain how to create crystalreports in asp.net.
In this article I will explain how to create crystalreports in asp.net.
Description:
In Previous posts I explained lot of articles regarding Asp.net, Gridview, SQL Server, Ajax, JavaScript etc. Now I will explain about crystal reports it is standard reporting tool for visual studio by using these we can display reports regarding employee details and display charts etc and crystal reports need minimal coding to display result.
In Previous posts I explained lot of articles regarding Asp.net, Gridview, SQL Server, Ajax, JavaScript etc. Now I will explain about crystal reports it is standard reporting tool for visual studio by using these we can display reports regarding employee details and display charts etc and crystal reports need minimal coding to display result.
To implement crystal reports first design the table in database and give name UserInfomation
ColumnName | DataType |
UserId | Int(set identity property=true) |
UserName | varchar(50) |
FirstName | Varchar(50) |
LastName | varchar(50) |
Location | varchar(50) |
After completion of table creation enter some dummy data because we need to use that data to populate reports. Now Open visual studio 2008 and create new website and open Default.aspx page in Design mode after that open Toolbox from that drag and drop MicrosoftReportViewer control from Reporting tab
After drag and drop MicrosoftReportViewer in your page select ReportViewer control and click on smart tag in right side and select Design a new Report
After click on Design a new report now welcome window wizard will open
Now click on Next button after that new Data Source Configuration Wizard will open in that click on New Connection button to configure database connection.
Now one window will open to add new connection in that enter Server Name and select authentication type either windows or SQL Server and select database name after fill all the details click on Test Connection if the connection path is correct then that will display Test connection succeeded. After that click ok
After click ok New database connection added to dropdown now click on Next button
After click Next it will display available Tables, views, Stored Procedures and Functions in DataSource Configuration Wizard in that open Tables section and select required table previously we created table with name UserInformation now I am selecting that table from available list
After click finish our report wizard populate with our selected table now select that table and our Next button
After click Next button it will display options to select Report type either Tabular or Matrix now select Report Type and click Next Button
After click Next Report Wizard display Design the table option with available fields from previous selected table and give options like Page, Group and Details these are used to display the data based on Groupwise etc. Here we are doing simple crystal report sample I am not doing anything simply click on Next Button
After click Next button Report wizard will display option to select Table layout after select required table layout click on Next button
After click Next button Report wizard will display option to select Table style after select required table style click on Next button
After click Next button Report wizard will display Completing the Report Wizard in that enter Report Name and click Finish button
After click Finish button now it will create new report if we open our website Solution Explorer we have chance to see newly created report Report1.rdlc and xsd file in App folder this xsd file contain our selected database table.
After that Now Open Default.aspx page and select ReportViewer and click smart tag in right side in that select Report Type
Once Report1.rdlc selected Open Default.aspx Source code it contains code like this
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <div> <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" Height="342px" Width="398px"> <LocalReport ReportPath="Report1.rdlc"> <DataSources> <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="MySampleDBDataSet_UserInformation" /> </DataSources> </LocalReport> </rsweb:ReportViewer> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData" TypeName="MySampleDBDataSetTableAdapters.UserInformationTableAdapter"> </asp:ObjectDataSource> </div> </form> </body> </html> |
If you above code Here we added referece of assembly for Reportviewer that is necessary to run our report perfectly. Now Run your application check the output that would be like this.
Demo
Please give your comments regarding above topic is it ok or not and if you like the post please share it.
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
58 comments :
now only i am knowning about this topic ,can i know in which cases it is very usefull
I want to learn more and more in Dot Net
Thanks a lot Dear.
This has solved my problem.
God bless you.
Thank u
thanks u....
how to display images in a report which are store in sql server 2005 in the binary format...
presently the image column is displaying error...
check this post to display images in crystal report
http://www.aspdotnet-suresh.com/2012/02/dynamically-display-images-in-crystal.html
how to upload a crystal report on webserver because when i was trying i got these error
Could not load file or assembly 'CrystalDecisions.Web, Version=10.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
Please reply me also on my email
bharatgunjal2010@gmail.com
thanks in advance......
thank you sir this info help full lot....keep giving this info...
Good topic to learn
Tanks buddy for this
Hello, Great Article.. I link.. Thank you very much. Keep it up. God bless you.
Hi,
I an Unable to establish connection with teh database. The error i am getting is:
"An unexpected error has occurred.
Error Message: Could not load type 'Microsoft.VisualStudio.DataDesign.SyncDesigner.SyncFacade.SyncManager'from assembly 'Microsoft.VisualStudio.DataDesign.SyncDesigner.DslPackage,Version=9.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a'."
Kindly reply back to yaminisaxena7@gmail.com
Thanks a lot ...
it is very easy to understand.
Veryyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy
Useful..
Thanks man
good example
Very good post. Do you have any suggestions to generate report with combination of number of tables with their Foreing_Key and use code behind binding with dataSource. Please let me know how to solv this problem.
Hi this contribution is tooooooooo goood thanks man.
Superb Tutorial...Really Helpful to me..Thanks Bro...
Thinks so much for this tutorial
Thanks so much for this tutorial
Really helped a lot
thank you very much i was stuck to submit my project because of these report
but now i know how to use it
thank u......
Article was so Simple & Useful
Many thanks,
Leo
Excellent Article For Beginner
Thanks a lot for sharing.
i like this
thanks a lot
its very good,thanks!!!!!
ya.. its very usefull..
given in a specific manner.
it is very helpfull..
thank u.
Thanks, Successful work this code..Tc
Thanks dude... keep sharing as much as you know....
how to bind already exist javascript file into dropdownlist in asp.net? presently its bind html code bt i want asp.net dropdownlist
it's very helpfull 4 me
thanks a lot...........
how should install report viewer ?
it's very helpfull 4 me
thanks a lot...........
thanks sir very useful information.
how to dynamically(by coding) create a report through report viewer using asp.net with vb.net.....plz help me
This article describes Reporting Services, not Crystal Reports!
ya it is very useful ...10q
sir how can i generate a report date wise pls help assp.
thank u
9965656611
very well explained...thnx for help
thankx
it is very useful
yes its very helpfull for me
First of all you are not using Crystal Report. You are using visual studio report viewer. Please correct it
Thank you Suresh. Really very useful.
good but HOW CAN WE SHOW COMPLETE DATA OF GRIDVIEW IN CRYSTAL REPORT?
hello Suresh,
I have tried this but when I click on finsh button it gives me a Exception.
Please Help me. to over come this problem.
how i can show report without report viewer
It's very nice..thanks...i want to know more about crystal report..plese any url.
Please Post LINQ TUTORIALS PLEASE
Its very helpful buddy.
your site are good to understand....
Hai Suresh Garu....
Excellent Site For Beginner
super...........
Hi sir i want know about crystal report paging and when the create setup file in windows application that time what do so attached for crystal report components plz ...............help me sir
Hi Sir,
This site is very useful for beginners and Intermediate developers.
Thank you very much
how to use combination chart using crystal report in asp.net
its very help ful
Login failed for user 'sa'.
This Exception occure
Note: Only a member of this blog may post a comment.