Sample Crystal Report in VS2010

Hi We explore sample crystal report creation in visual studio 2010 using C# asp.net.We start first from database. I create a sample database by name Department and a table named Clg.In this table i have tuples as ID, Dept_name and HOD with 4 records.We display the entire table data as a report.
1. Now create an empty new web-project with name as Sample_crystal.
2. Add a webform named as webform1.aspx and add crystalreport which populates a wizard select Standard report and blank report then click ok.
3. Drag-drop the dataset1.xsd from toolbox and on which drop clg table from server explorer.
4. Drag-drop the crystalreportviewer on to the webform and in page_load event add the code as::
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(“Data Source=.\\sqlexpress;Initial Catalog=departmetn;Integrated Security=True;Pooling=False”);
SqlDataAdapter da=new SqlDataAdapter(“select * from clg”,con);
DataSet ds=new DataSet();
da.Fill(ds,”clg”);
CrystalReport1 o = new CrystalReport1();
o.Load(Server.MapPath(“CrystalReport1.rpt”));
o.SetDataSource(ds.Tables[“clg”]);
CrystalReportViewer1.ReportSource=o;
CrystalReportViewer1.DataBind();
}
5. click the field explorer (just as toolbox,server explorer) @ crystalreport.rpt screen select Database fields–>database expert then select our dataset.
6. Expand the database Fields and drag-drop the columns of table on the crystal report Section 3(Details).
Run the application which yields the exact report from database.

Qursheed’s Blog Designed To Upgrade Careers

Welcome to the World of Microsoft Technologies…

Technology refers to study of art, skills.. The word Technology is derived from Greek.
Here we mainly focus on Microsoft Technologies.

C#.Net | ASP.Net | ADO.Net | JavaScript | Model View Control | WCF
Crystal Reports…and many more…

Please go through all blogs where you find the resources by which you can start the technology learning, building and deployment…Enjoy…Be Happy…

Visit us for more POCs and Walkthroughs…

Current Blogs includes:
InterView Questions For 3+ Years Experienced .Net Professionals
WCF Part 1
Know Your Controls