Click here to Skip to main content
11,805,316 members (65,381 online)
Click here to Skip to main content

Creating a simple but useful Crystal Report

, 28 Nov 2012 CPOL 82.4K 13
Rate this:
Please Sign up or sign in to vote.
Crystal Reports for beginners.

What is Crystal Reports?

Crystal Reports is a database reporting application. It has powerful capabilities to access and analyze various sources of data for its reports.

Note: Please do comment for suggestions and improvements for me to update my first tip/trick entry. Thanks!

Steps in Making Crystal Report

First, you need to download the complete package in:

*VS = Visual Studio

For VS2010:

For VS2008:

After Download and Install. 

  1. Create a new project.
  2. Add a CrystalReportViewer to your WebForm.

Select the project name and then perform the following:

  1. Add New Item
  2. Select Report and then select Crystal Reports
  3. Save your File as "StudentList.rpt"

Just close the dialog box that appear or select Blank Report

A Blank report will be created.

Now, select the project name and then perform the following:

  1. Add New Item
  2. Select DataSet
  3. Save your DataSet as "StudentRec.xsd"
  4. Drag a table from your Sever Explorer going to your DataSet designer.

Go back to CrystalReport.rpt.

Create a class Library and named it as "ReportHelper" and then rename the Class as "DataReport" and then write the following code below:

Note: This is the code when you are using a DataSet.

using System.text;
using System.Data;
using System.Data.SqlClient;

namespace ReportHelper
    public class DataReport
       private static string _connString = @"Data Source";
        public static DataSet LoadReport()
            SqlConnection myConn = new SqlConnection(_connString);
            SqlDataAdapter da = new SqlDataAdapter("Select * from StudentRecord", myConn);
            DataSet ds = new DataSet();
            da.Fill(ds, "StudTable");
            return ds;

On Page_Load event write the following code and then run your application.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ReportHelper;
using System.Data;
using System.Data.SqlClient;

namespace CrystalReport

    public partial class WebForm1 : System.Web.UI.Page    {
        protected void Page_Load(object sender, EventArgs e)
            DataView dview = new DataView();
            dview.Table = DataReport.LoadReport().Tables["StudTable"];

            StudentList myreport = new StudentList();
            CrystalReportViewer1.ReportSource = myreport;

I hope that this Tip may help you to understand and create a simple but useful Crystal Report.

Thank you for reading my tip.

-Jason P.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
Philippines Philippines
Web Addict.
Focused on PHP Programming.
Back - End.

You may also be interested in...

Comments and Discussions

QuestionSteps missing Pin
Member 1148523327-Feb-15 3:25
memberMember 1148523327-Feb-15 3:25 
QuestionNeed stored procedure for this crystal report Pin
dino04143-Jul-14 1:09
memberdino04143-Jul-14 1:09 
GeneralVery Nice Post Pin
dino04142-Jul-14 21:38
memberdino04142-Jul-14 21:38 
Questiondownoad crystal report for the visual stdio 2014 Pin
Member 101960382-Jun-14 7:33
memberMember 101960382-Jun-14 7:33 
QuestionError Pin
Member 1076309720-Apr-14 21:10
memberMember 1076309720-Apr-14 21:10 
GeneralMissing Images Pin
Tim Corey27-Nov-12 2:41
memberTim Corey27-Nov-12 2:41 
GeneralRe: Missing Images Pin
esonparedes27-Nov-12 13:17
memberesonparedes27-Nov-12 13:17 
QuestionNot an article.. Pin
Monjurul Habib26-Nov-12 18:46
memberMonjurul Habib26-Nov-12 18:46 
AnswerRe: Not an article.. Pin
esonparedes26-Nov-12 18:57
memberesonparedes26-Nov-12 18:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.151002.1 | Last Updated 28 Nov 2012
Article Copyright 2012 by esonparedes
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid