Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
How to create simple Crystal Reports in asp.net with neat example.
 
reply me sir
Posted 6-Oct-11 2:49am
Edited 6-Oct-11 2:53am
Nueman8.3K
v2
Comments
RDBurmon at 8-Jun-12 8:27am
   
Thanks Everyone who replied to this thread , So Mohan, I think you have got enough response and you should be able to mark it as your answer and close the thread.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

These two examples should be useful to you -
Crystal reports in ASP.NET[^]
Creating Crystal Report in ASP.NET[^]
  Permalink  
Comments
Sampath Lokuge at 14-Feb-14 1:37am
   
+5 :)
Abhinav S at 14-Feb-14 2:20am
   
Thank you.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

  Permalink  
Comments
Oshtri Deka at 8-Jun-12 7:56am
   
Yep. Linked article is great.
Sampath Lokuge at 14-Feb-14 1:37am
   
+5 :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Look at he following:
 
http://forums.asp.net/t/1571760.aspx/1[^]
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

The best solution is using stored procedure...............
1.Make A Store Procedure with all the fields from the table which is required in the report.
2.then add a .rpt file in your solution.
3.for designing of report, in field explorer add the stored procedure you made.Drag and drop the fields in the way you want.
 
You can directly add tables in the field explorer in place of making stored procedure.......but the report will open very slow as the data in database will increase..........................
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

using visual studio u can do crystal report
If u cant instead u can use gridview
  Permalink  
Comments
Ashwini kumbhar at 24-Apr-13 1:50am
   
how to add sql database in solution explore
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 7

We can create a crystal report.net using the following steps:
 
Create a Dataset and define the schema by drag and drop the database table from Server Explorer.
If there are multiple tables then put all the tables within one dataset itself.
 
STEPS:
Right Click Solution Explorer -> Add -> Add New Item -> choose DataSet under the Categories (Web Project Items - data).
 
Add new Connection in the Server Explorer and expand the connection to retrieve the database tables and choose the required table and drag and drop it in the Dataset xsd pane.
 
Generate Dataset from the Dataset XSD.
 
STEPS:
Right click on the dataset xsd pane and click Generate Dataset
 
Create Crystal Report.
 
STEPS:
Right Click Solution Explorer -> Add -> Add New Item -> choose Crystal Report under the Categories (Web Project Items).
 
Configure the Crystal Report.
 
STEPS:

Select Report Layout, ProjectData, ADO.NET DataSets
Expand ADO.NET DataSets and select the table
Select the fields
 
Create a WebForm and drag and drop the CrystalReportViewer control from the Toolbox(General).
 
Put a textbox and button
 
Open the Code window of the WebForm and write the following code.
 
And change the value of the connectionstring variable sqlConn.
Webform1.aspx.cs

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;

namespace CrystalReportEg
{
///
/// Summary description for WebForm1.
///

public class WebForm1 : System.Web.UI.Page
{
protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button1;
public Customer oRpt = null;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here

}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
oRpt = new Customer();
GenerateReport();
}

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

private void Button1_Click(object sender, System.EventArgs e)
{
GenerateReport();
}
protected void GenerateReport()
{
SqlConnection sqlConn = new SqlConnection("Server=localhost;uid=sa;password=;initial
catalog=Northwind;");

SqlCommand comd;
comd = new SqlCommand();
comd.Connection = sqlConn;
comd.CommandType = CommandType.StoredProcedure;
comd.CommandText = "up_GetAllCustomer";

comd.Parameters.Add("@Companyname",SqlDbType.VarChar,50);
if(TextBox1.Text.Trim()!="")
comd.Parameters[0].Value=TextBox1.Text;
else
comd.Parameters[0].Value=DBNull.Value;

SqlDataAdapter sqlAdapter = new SqlDataAdapter();
sqlAdapter.SelectCommand = comd;

Dataset1 ds = new Dataset1();
sqlAdapter.Fill(ds, "Customers");

oRpt.SetDataSource (ds);

CrystalReportViewer1.Visible=true;

CrystalReportViewer1.ReportSource = oRpt;
}
}
}

Hope this will give you a clear picture of the web crystal report generation.
  Permalink  
Comments
Ashwini kumbhar at 24-Apr-13 1:50am
   
how to connect database in solution explorer

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

  Print Answers RSS
0 CHill60 290
1 OriginalGriff 245
2 CPallini 198
3 Sergey Alexandrovich Kryukov 194
4 Aescleal 140


Advertise | Privacy | Mobile
Web03 | 2.8.141015.1 | Last Updated 3 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100