none
SQ| reporting RRS feed

  • Question

  • HI,

    i am trying to view datatable or dataset as a report in reportviewer using  " c# /windows forms "

    any helps  ??

    thanks 

    my code is 

    [

                                                        

    dada1 sss=new dada1();///this is dataset



    SqlConnection con = new SqlConnection(@"Data Source=ADMIN-PC;Initial Catalog=users;Integrated Security=True");
                    string query = par;
                    SqlCommand cmd = new SqlCommand(query, con);
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    DataTable dt = new DataTable();
                    da.Fill(dt);
                     da.Fill(sss);
                    dataGridView1.DataSource = dt;
                    DataSet ds = new DataSet();
                    ds.Tables.Add(dt);

                    Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new        Microsoft.Reporting.WinForms.ReportDataSource();
                    reportDataSource1.Name = dt.TableName;
                    reportDataSource1.Value = dt ;
                   // reportViewer1.LocalReport.ReportPath = @"C:\Users\admin\Desktop\the enterprise\the enterprise\Report1.rdlc";
                    reportViewer1.LocalReport.DataSources.Add(new ReportDataSource(dt.TableName, dt));
                    reportViewer1.RefreshReport();

    ]


    Sunday, February 1, 2015 10:30 AM

All replies