Hello, Everybody, I hope you all of fine, today I have shared Crystal Reports Tutorial for absolute beginners. Basically, Crystal Reports is a tool which is used to generate the Reports. When you will create an application, you must include the Crystal Report functions. It is very helpful and beneficial for customers.
I have seen more than beginners, they are facing problems to generate reports using Crystal Reports. There are many ways to generate reports, but I will share you easily methods. Recently I have made an application with help of C# and SQL Server, So, I have included Crystal Reports for generating the reports. So, I want to you will learn how you can generate the reports.
Furthermore, more than developer using Crystal Reports to generate reports. But some developers using different methods to generate reports such as Excel Format or PD Format. But, this is not enough for generate professional reports.
How to Create Crystal Reports in C# windows application
Let’s get started to generate reports, first of all, you need to create a database and also tables in SQL Server. Below I have shared the queries to create a table in SQL Server.
You May Also Like: Download & Install Crystal Reports
create table studenttbl
Student_Id int primary key identity(1,1),
Above mentioned queries are used to create a table in SQL Server. I already inserted the records, you need to insert the record as you like.
You May Also Like: Combobox Link to Database in C#
Then you need to Create a Project in Visual Studio. Then you need to drag and drop DataGridView Tools to display Database Values. Then you need to Insert a Button to create an Even, below I have shared the Screenshot.
After insert data grid view and Button, you need to Double Click on the Form Center Poration. Then you can see the event has generated. Then you need to write the codes to load database values in grid view.
Crystal Reports Tutorial C#
public partial class Form1 : Form
SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-QG2VIHO\SQLEXPRESS;Initial Catalog=tutorial;Integrated Security=True");
private void Form1_Load(object sender, EventArgs e)
adpt = new SqlDataAdapter("select * from studenttbl", con);
dt = new DataTable();
dataGridView1.DataSource = dt;
Then the data has displayed in Gridview as well. The next step is you need to create an another Windows Form Application. Then Drag and drop Crystal Report Viewer in the Windows Form Application, below I have shared the Screenshot.
Then you need to Go to First Form and Double Click on the Button to Generate Even on Click.
Then you need to write the below codes to display another form on Button Click.
private void print_Click(object sender, EventArgs e)
CrystalReportsFrom cry = new CrystalReportsFrom();
Then you need to make dataset to load the SQL Server Table data on the Dataset. Right, Click on the Project, Add>New below screen shot attached.
After the Click New Option, you can another window. You need to Go on Left Side Click to Data and Dataset.
After creating a dataset, you will redirect another page look like this screen shot attached on below.
Then you need to connect SQL server to import database tables in the dataset. First of All, go to Server Explorer > Data Connection right Click it. Then Go to Add Connection Option, after click Add Connection you can another window, you need to Enter the SQL Server Name. Then Select Database, which provides the database tables records.
You May Also Like: School Management System in C#
Then you need to Click to Drop Down Arrow Sign, It has displayed on the left side in Solution Explorer. Then you can see Tables, Views, Stored Procedure etc. You need to Click on Tables and Drag and Drop Table in Dataset.
Then you need to create crystal reports. Go to Solution Explorer right Click on the Project Add>Add New Item.
Then you will redirect another page, you need to Click on Reporting Option and Select Crystal reporting.
Then you will redirect another page, you need to select Using the Report Wizard Option.
Then you need to Click to Create New Connection>OLE DB (ADO). Then you need to Select Microsoft OLE DB Provider for SQL Server.
You May Also Like: How to Generate QR Code in C#
Then you need to Enter the SQL Server Name and Select Your Database.
Then you need to Click Next and Finish. After that, you can see the database attached with OLE DB ADO.
The You need to Click to Database Plus sign to find the table. After finding the table you need to Click on the Table and Click to > This Sign.
Then you need to move all table column with another box. Below Screenshot attached.
Then you need to Click Finish Button and Go to Crystal Viewer Form. Then you need to Click on Play Sign on Crystal Report Viewer and Select Second Option. Then you can see the Crystal Reports showing on your Screen Click it.
That’s it, your crystal reports ready to generate reports. However, I, Want you to watch Crystal Reports Tutorial in Vidoe base. I have shared on below section video you can see.
Crystal Reports Tutorial For Beginners
Thanks for Visit and Watch the Crystal Reports Tutorial. I hope you have learned as well. Kindly, share on my content/course on social networks.
If you have any question/suggestion about this topic, kindly submit a single comment or email me. I will reply with your answer maximum 24 hours. Subscriber my Social Networks Pages and Email for getting updates. Thanks for the read and watch my video Tutorial.