Create and Bind Crystal Reports in ASP.Net without Dataset.
Here, we learn how to create crystal reports in asp.net, and how to bind data to crystal reports from sql server database. here we are bind data to crystal reports in ASP.Net without use of Dataset.
For binding data to crystal reports, first we must need to create a new database in sql server and create a table in database. Here we need not to create stored procedure for binding crystal reports.
Here, first we create new Database in sql server and create new Table within a Database.
- Create a new Table “DEMO” in SQL – server with some columns.
Here, We have created new Table UserMSt with Column Name and City.
Now , after create new database and table in sql server, now create a new asp.net web application for bind crystal reports.
- Add CrystalReportViewer on asp.net web forms from Toolbox for Display crystal reports.
Now, Right click on Project Title and go to Add New Item and select Crystal Report for add new Crystal Report in asp.net. here we can change the crystal reports name as our need.
When we Add new crystal reports, we have three options here select As a Blank Report and click OK.
Now, here we have created crystal reports now for binding data to crystal reports we have to do some step.
Field Explorer >> Database Field >> Database Expert >> Create New Connection >> OLE DB (ADO)
In database Expert select OLE DB (ADO) option in Create New Connection option then click OK Button to go next step.
Here, we have list of Database Server Provider for choose our appropriate database provide.
Select Microsoft OLE DB Provider for SQL Server click next to go ahead.
Fist check (tick) the Integrated Security option check box and then write the your Sql Server name like ComputerName/ServerName.
Here we have write .\NEWSQLEXPRESS indicate the sql server name. if we write right sql server name then all the Database of this server will be automatically displayed in below Database Dropdownlist.
Select your Database which you want to display in crystal reports and click next button to go ahead.
here, we do nothing, just click finish button to finish the sql server connection process.
Now, We have already connect the DEMO Database in our asp.net web application crystal reports Database Expert field.
Here, we can see all the table of DEMO Database, just add the table for display crystal reports by clicking arrow button.
We can see here UserMst Table already added for bind crystal reports.
now, just design the crystal reports with name and city columns like below screen.
we can see the crystal reports preview without run the asp.net web application, just click the Main Reports Preview button.
Here, is the final crystal reports out put of asp.net web application.