C# .NET - I want to create a rdlc reports in windows C# application. How to start and any tutorials.

Asked By Shan on 20-Jun-12 06:00 AM
I want to create a rdlc reports in windows C# application. How to start and any tutorials will be helpful.

 Thanks.
Ravi Maurya replied to Shan on 20-Jun-12 06:05 AM
Refer these two article 

http://kishor-naik-dotnet.blogspot.in/2011/06/aspnet-rdlc-report-in-aspnet.html

http://www.dotnetyoga.com/2011/10/how-to-use-rdlc-with-aspnet.html


Hope this might help you.
Jitendra Faye replied to Shan on 20-Jun-12 06:13 AM
These are the main namespaces for creating reports -

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Web;
using CrystalDecisions.ReportSource;


after that use this code-

using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using CrystalDecisions.Web;
using CrystalDecisions.ReportSource;
 
public partial class Default2 : System.Web.UI.Page
{
  SqlConnection sqlcon = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);
  SqlCommand sqlcmd;
  SqlDataAdapter da;
  DataTable dt = new DataTable();
  string sid,query;
   protected void Page_Load(object sender, EventArgs e)
  {
  if (!Page.IsPostBack)
  {
    sid = Request.QueryString["sid"];
    try
    {
    sqlcon.Open();
    //Check whether query string have value or not if not have value then select all record in below query otherwise select particular record with help of where condition
    query="Query for getting data from 3 tables";
    sqlcmd = new SqlCommand(query,sqlcon);
    da = new SqlDataAdapter(sqlcmd);
    dt.Clear();
    da.Fill(dt);
    if (dt.Rows.Count > 0)
    {
    ReportDocument RptDoc = new ReportDocument();
 
    RptDoc.Load(Server.MapPath("~/CrystalReport.rpt"));
    RptDoc.SetDataSource(dt);
 
    CrystalReportViewer1.ReportSource = RptDoc;
    CrystalReportViewer1.DataBind();  
    }
    }
    catch(Exception ex)
    {
    Response.Write(ex.ToString());
    }
    finally
    {
    sqlcon.Close();
    }   
  }
  }
}


Hope this will help you

Jitendra Faye replied to Shan on 20-Jun-12 06:14 AM
Crystal Report comes with its own SDK which can be used to programmatically create reports and interact with them at run time, if one desires do so. Crystal Reports can be us in either Windows or a web application.



folow these link for example-

http://www.aspfree.com/c/a/.NET/Generating-a-Simple-Crystal-Report-using-VS-2005/

also follow these links for cristal report-

http://www.codeproject.com/KB/architecture/Crystal_Reports.aspx
http://msdn.microsoft.com/en-us/library/ms227881%28v=VS.80%29.aspx
http://aspalliance.com/661_Create_Crystal_Reports_on_the_Fly_using_ASPNET.all

Here you will get sample code also.
Lalit M replied to Shan on 20-Jun-12 07:55 AM
Check this link.

http://msdn.microsoft.com/en-US/library/ms252067%28VS.80%29.aspx