From this post, I will show you how to create a basic Crystal Report. You don't need to have previous knowledge in reporting. Just a little bit knowledge in C# and SQL would be enough.
In SQL Server, I'm creating a database named 'Company' and inside that I have a table named 'Employee'. An employee has an id, a name and a designation. Sample values are added into the Employee table.
In SQL Server, I'm creating a database named 'Company' and inside that I have a table named 'Employee'. An employee has an id, a name and a designation. Sample values are added into the Employee table.
Then in the dialog box, select 'Data' as the Category and from Template, select DataSet. The name for the new data set is given as EmployeeDataSet.xsd in this example. Then click Add.
Then the EmployeeDataSet.xsd file will be opened. If not open it from the Solution Explorer. In the Toolbox, under DataSet, click on the TableAdapter, drag it to the working area and drop it.
Then the Table Adapter Configuration Wizard will be opened.
Click on New Connection. Then give the database details appropriately. In this example, server name is localhost and the database is Company. Then test the connection.
Once the connection is successful, click OK.
Now the connection string is created. Click next in the Table Adapter Configuration Wizard.
In the next window, you can give a name for the connection string. For my convenience, I'll leave the default name. Then click Next.
In the next window, you can specify the SQL query for the table adapter. I'll use the Query Builder to build the query.
In the Add Table window, select the tables you want for the query and click on Add. Then close the window. In this example I'm adding the Employee table.
Then select the columns needed for the query and click Execute Query to view the result. Then click OK.
Now the query is successfully built. Click Next.
Now the table adapter is successfully configured. Click Finish.
Here I'm creating a Standard Report using the Reporting Wizard.
In the wizard, select the data table that you want in the report. Here I'm selecting the Employee table. Then click Next.
Then select the fields to be displayed in the report and click Next.
Next thing is filtering fields. Here I don't need any filtering so I'll click Next.
Next thing is selecting a style for the report. I'll select Standard style and click Finish.
Now the report is created. You can drag the fields and customize the appearance. Add lines and images if you need. I'll just leave it as it is.
Now the designing is over. Now we need to view the report. Get the Windows Form (here Form1). In Tool box, under Reporting menu, click on the Crystal Report Viewer and drag it to the form and drop.
Now run the project and see the output report.
Feel free to put your comments here !
-Tharindu Edirisinghe
-SLIIT 10'
73 comments:
Thank you very much.!! keep it up good work always... :)
Anytime :)
how to create dynamic crystal report in windows application . and my database is password protected so i want to fetch records using where query on load. please help me.
this is the normal way
http://thariya.blogspot.com/2012/04/how-to-create-basic-crystal-report.html
If the database is password protected, you can configure that in an App.config file
Thank You Very Very Much Dear .. !!
Keep It Up Dude......
Thank You Very Very Much Dear ...!!!
Keep It Up Dude ......
Thank you So much...!!!
hey bro.. can u give some tips for SEII
drop me a mail via thariyarox@gmail.com . I'll give u some tips on SE II.
I would like to prepare a crystal report without using wizards after getting data source and connection string and would like to display it in a web form.
Thanks very much
Thanx very much Bro.
Hi,, I can not add the CrystalReportViewer in my repoert tab,, please, helm me
What is the visual studio version you are using ? If it is 2010, Crystal Reports do not come inbuilt. You have to manually install it. Comment here your problem and I'll help you with that...
i already have db i just want to show database on report page plz help me how can i do that
It's the same way as mentioned in the post. In the beginning of the post I create the database and tables. Since you already have the database, start from the middle of the post and follow the steps.
Will You Please guide me how to generate reports from multiple tables?
Same as above, in the Query Builder, add the tables you want and select the fields you want to be included in the report.... and done... :)
u give me an idea!!!thank u very much!!i newbie to crystal report and vb.
Thanx a lot machan
hi how to create reports using crystal reports in visual studio 2010, crystal report is downloaded and installed, i want to know how to generate reports in windows aplication
It's pretty much the same.. Didn't you try the above steps in VS 2010 ??
new SampleCrystalReport. ??? which is that??
Hi. How will you generate a report in Crystal report with a string parameter in c#.Hope you can help me.. thanks
Hi yoggy marshmallows, Check the following link
http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-string-parameter.htm
I already checked it and try but there's an error there in the line "cryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt");"
I put the fullpath of the crystal report but theres an error. on that. hmm any idea on how to do that? Thanks
really usefull
Thanks dude Work Sucessfull Always
--> Can u tell me how to Set a height & width report
--> Exmple 1)Report Envelop Size 2) Cheque Size Both Are Work Single Project
Really Useful Brothers.. Keep Going
Hi,
I have a image path in table. How do i display the image in crystal report by using image path.
Search in Youtube. You can find the answer.
i want to create a crystal report in c#.net windows application ...............
plz any one can help me how to display report name wise o
i want to create a crystal report in c#.net windows application ...............
plz any one can help me how to display report name wise o
nice work
thanx
v v nice
I want to write in words of sum to TotalAmount in report. Help me....
@Sohan - if you can provide more information, I'll be able to help you.
thanks a lot
if i want to build a query with a Where clause what i should do?
really I have a form Like a bill and I want to send just the new bill
first it save to db and then send to crystal report
how I do this ??!!
@Masoom -
It's not much different to this... just google for "parameterized crystal reports" and you can find plenty of examples.
Good work aiya.........
Madanga(SLIIT Student)
Good work aiya keep it up............!
Good work aiya.........
Madanga(SLIIT Student)
i cant understood emplyeedatatableadapter.empyoyeeTableAdapter ta
the first word of 4th line
@Althaf - it starts with the name Employee.... because the table name here is Employee. If you have a table name with a different name, the table adapter class name will begin with that name.
sir by running your code i found 21 error one of which is
Error 31 The name 'CachedReportConstants' does not exist in the current context
@Mohammad - Check if the following link is useful
http://social.msdn.microsoft.com/Forums/en-US/8c1c74c6-3916-460a-9fef-f211df75898e/crystal-reports-not-working-on-preexisting-project
A full tutorial http://csharp.net-informations.com/crystal-reports/csharp-crystal-reports-tutorial.htm c# crystal reports tutorial
maaki
when i create crystal report in vs 2010 using sql data base i face error
Could not load file or assembly 'file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.
then i search on google n find solution to add below code in app.config
but my application give me some error like
Could not find schema information for the element 'log4net'.
Could not find schema information for the element 'appendToFile'.
Could not find schema information for the attribute 'value'.
Could not find schema information for the element 'rollingStyle'.
Could not find schema information for the attribute 'value'.
Could not find schema information for the element 'maxSizeRollBackups'.
Could not find schema information for the attribute 'value'.
Could not find schema information for the element 'maximumFileSize'.
Could not find schema information for the attribute 'value'
.Could not find schema information for the element 'staticLogFileName'.
Any one help me pls ..
Very nice dude.. :) keep it up..
Can't detect the database
Hi Bima, check whether you have entered the Server name correctly
I amusing C#.NET 2012 express and I couldn't find reporting on Add item in project,is there any way to create a report on C#.NET 2012 express
thanx .....
Hi Tharindu Edirisinghe,
I generate the crystal reports as it is your articles. It works till the end, but when i run the coding it produce the empty screen with date only. I couldn't able to find where i made mistakes. can you please help me.
thank you,
Arunkumar M
Hi Arunkumar, I'd like to help. Drop me an email through the contact me page in the top menu and I'll contact you through emails.
Awesome Carry On the Good Work.. :D (y)
thanx, finally your blog helped me ,, ! great work sir
Could not load file or assembly 'file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.
why this error shows???help me
Could not load file or assembly 'file:///C:\Program Files\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1\crdb_adoplus.dll' or one of its dependencies. The system cannot find the file specified.
why this error occur??
help me to solve this error.
Thank you very Much Boss.. Your simple material has changed my entire programming career for good... How I wish you will grant me access to more of your C# Vs SQL Server 2012 materials. I will be very happy my able Mentor.. [my mail : ngwubonaventureikennadj@gmail.com] Thanks Boss
Thank you very Much Boss.. Your simple material has changed my entire programming career for good... How I wish you will grant me access to more of your C# Vs SQL Server 2012 materials. I will be very happy my able Mentor.. [my mail : ngwubonaventureikennadj@gmail.com] Thanks Boss
More on crystal reports....
Crystal Reports Tutorial
Ling
Can I know either empty website able to create crystal report or not? its because I have already done my project and I just realized that to create crystal report we need using windows form application. Can you have help me to solve this problem?
quite ok
hai,
Its realy helpfull to me.....thank you brother.
I developed a report in crystal report in C# Windows application but unable to view the full report in screen. For view the report I am scrolling the mouse up & down pls help.
Hi,@Tharindu Edirisinghe,
I want to create a crystal report on selection of some radio button,combo box, and after that on click of generate button report form is shown, I want to show that field of data which i had selected by radio button, combo box. My database is in Access. That means i need a particular field of data not all.
PLZ suggest me some link or plz do some for me.
Hello all members plz tell me how to search in crystal report using textbox windows application using c#
really Helpful..
Hi,
I am using Visual Studio Ultimate 2013 and I can't see Crystal Reports Template. And I am using MS Access Database. How do I go about this? Please help. Thanks.
Great job Dear
Dear Friend,
Very useful post
I have been searching this type of guide for a long time.
Thanks a lot ....
Post a Comment