Simple crystal report in asp.net

Crystal report is very useful readymade tool for representing reports with lots of options, It saves lot of hard work of developers.
For making Crystal report create table Sales in sql server.
Create table Sales(
 id int identity primary key,
 Employee varchar(30),
 Zone varchar(12),
 sale money

)


 

enter some data in table
insert into sales(Employee,Zone,sale)values('Ashish','East','2000');
insert into sales(Employee,Zone,sale)values('Pritam','North','5000');
insert into sales(Employee,Zone,sale)values('Johan','North','12000');
insert into sales(Employee,Zone,sale)values('Pooja','West','7000');
insert into sales(Employee,Zone,sale)values('Monu','North','2000');
insert into sales(Employee,Zone,sale)values('Ansh','South','8000');
insert into sales(Employee,Zone,sale)values('Deepak','West','8000');
insert into sales(Employee,Zone,sale)values('Jacky','East','18000');

database work is finished.

 

Now we move to visual studio. Start new website project.Select ASP.NET Crystal Reports website. An option window opens, select blank report and then press ok. In default.aspx remove

<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
        <Report />
        </CR:CrystalReportSource>

 and ReportSourceID from

<CR:CrystalReportViewer ID="CrystalReportViewer1" ReportSourceID="CrystalReportSource1" runat="server" AutoDataBind="True" />

Now check, is there Field Explorer tab in visual studio  opened? if not then In visual studio's menu there is an option Crystal Report > Field Explorer, click here.  A Field Explorer tab will open.

 

In Field Explorer tab right click on Database Fieldes option and select Database Expert, A small window form is opened. Here click on Create New connection option in Available Data Resource and then clcik on OLE DB(ADO). A new window will open. From here select Microsoft OLE DB Provider for SQL Server and Click Next button. Next window will open for database Connection Information. Enter server name (Computer name) and database name and click check box of Integrated Security.Now Click on finished buton. After this again Data expert window will appear.Now in Data expert window on left side database name will appear, click on database name, then click on dbo select Table sales and click on button with > (arrow) . Finally click on Ok button.

After finishing database connection in Fields Explorer, click on Database fields, table sales will appear under Database fields. Now click on table sales, fields of table sales will appear. Drag fields of tables sales one by one on Crystal report in section 3 (Details) of Crystal Report. Run it and see the result