May 22, 2024


Entertain Reaching Stars

ASP NET Hosting – Tips to Generate Crystal Reports in Visual Studio 2012

2 min read

Crystal Reports is a powerful software to design dynamic and interactive report designed for developers. It allows to conceive, investigate, explore and diffuse reports from the web or integrate into company applications. The report is made from a friendly and ergonomic graphic interface.

Furthermore, Crystal Reports is a popular Windows-based report writer (report generation program) that allows a programmer to create reports from a variety of data sources with a minimum of written code. Developed by Seagate Software, Crystal Reports can access data from most widely-used databases and can integrate data from multiple databases within one report using Open Database Connectivity (ODBC).

Microsoft Visual Studio 2012 is the latest Integration Development Environment (IDE) from Microsoft. But the question arises. Why should I switch over to VS 12, when I am very much comfortable with VS 2010 or 2008? This is a question that comes out from most techies. Most of us get used to an environment and when a new one comes we often think to switch over to it. The five features that will compel you to switch over to VS 12:

  1. The All new Look and Feel
  2. It is Ready for Windows 8
  3. Upgraded Web Development Environment
  4. It is Cloud Ready and Up for Serious Business
  5. It has a flexible and Solid ALM

Microsoft Visual Studio 2012 enables developers to quickly create connected applications that deliver rich user experiences. Visual Studio delivers advances for developers in three primary areas:

  • Rapid Application Development
  • Break Through User Experiences

In this article I want to generate Crystal Report in Visual studio 2012 for ASP.NET. Follow the below steps:

  1. Took a DataSet, then added a DataTable. Added three columns as of my sql database table: id, pname, price.
  2. Took a CrystalReport.rpt and Selected Use Report Wizard. Added dataset.

using CrystalDecisions.CrystalReports.Engine;

using CrystalDecisions.Shared;
using System.Data;
using System.Data.SqlClient;

public partial class _Default: System.Web.UI.Page

private SqlConnection cn = new SqlConnection("user id=sa;password=chiklu;database=SRS;server=CHIKLU-PC");
protected void Page_Load(object sender, EventArgs e)

SqlCommand cmd = new SqlCommand("SELECT,abcd.pname,qwer.price FROM abcd JOIN qwer ON",cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
ReportDocument rpd = new ReportDocument();
CrystalReportViewer1.ReportSource = rpd;

That’s steps to generate crystal report in Visual studio 2012 for ASP.NET.

Copyright © | Newsphere by AF themes.