Display bulk of records in tabular format using Crystal report viewer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shaliniraji
    New Member
    • Jan 2015
    • 15

    Display bulk of records in tabular format using Crystal report viewer

    Hi Everyone,

    I would like to display application form as tabular format for that am using crystal report viewer..Here my issue is in my table I have bulk of data's but when i run my application it shows only 1st row of the table..I would like to display all the records which are present in table..

    Here am using C# winforms,visual studio 2010,sql server 2008..

    Here is my code:
    Code:
    private void Report_Load(object sender, EventArgs e)
            {
                ReportDocument crystalreport = new ReportDocument();
                crystalreport.Load(@"D:\Development\VS2010 Projects\MVC Applications\Application_Print_CrystalReports\Application_Print_CrystalReports\leavereport.rpt");
                 //Here am writing query to display all the records which are present in the table
                Customers dscustomers = GetData("Select * From Leave_Form");
                crystalreport.SetDataSource(dscustomers);
                crystalReportViewer1.ReportSource = crystalreport;
                crystalReportViewer1.Refresh();
                crystalReportViewer1.Dock = DockStyle.Fill;
                this.Controls.Add(crystalReportViewer1);
            }
    
            //Here customers is my dataset name
            private Customers GetData(string query)
            {
                string conString = ConfigurationManager.ConnectionStrings["Myconn"].ConnectionString;
                SqlCommand cmd = new SqlCommand(query);
                using (SqlConnection con = new SqlConnection(conString))
                {
                    using (SqlDataAdapter sda = new SqlDataAdapter())
                    {
                        cmd.Connection = con;
                        con.Open();
                        sda.SelectCommand = cmd;
                        using (Customers dscustomers = new Customers())
                        {
                            sda.Fill(dscustomers, "DataTable1");
                            return dscustomers;
                        }
                    }
                }
            }
    Here is the snap shot of my application:
    [IMGnothumb]https://bytes.com/attachment.php? attachmentid=85 60[/IMGnothumb]
    Attached Files
    Last edited by zmbd; Dec 7 '15, 02:32 PM. Reason: [z{placed image in-line}]
  • madankarmukta
    Contributor
    • Apr 2008
    • 308

    #2
    You hav to extract which property of the report should be set to set the no. Of records.

    There has to be certainly, if more than one record, needs to show in the report.

    Regards.

    Comment

    • shaliniraji
      New Member
      • Jan 2015
      • 15

      #3
      Hi,

      Could you please explain with some more in detail..I am new to crystal report..If i use like normal table it shows all the rows present in table instead of normal table if I design like application form then it shows only 1st row of the table...

      Comment

      Working...