none
Excel Query And Prinout RRS feed

  • Question

  • <pre lang="x-c#">string ConnectionString = "Provider =Microsoft.Jet.OLEDB.4.0;" +
              "Data Source=" + openFileDialog1.FileName.ToString() + "" + ";Extended Properties='Excel 8.0;';";
            OleDbConnection Conn = new OleDbConnection(ConnectionString);
            OleDbDataAdapter adap = new OleDbDataAdapter("Select * From [Sayfa1$A:X]", Conn);
    
            DataTable dt = new DataTable();
            adap.Fill(dt);
            dataGridView1.DataSource = dt;
            DataTable dtclone = new DataTable();
            dtclone = dt.Clone();
            foreach (DataRow rowum in dt.Rows)
            {
    
              if (rowum["Durum"].ToString() == textBox1.Text.ToString())
              {
                dtclone.ImportRow(rowum);
              }
    
            }
            dataGridView1.DataSource = dtclone;
    
            reportViewer1.LocalReport.DataSources.Clear();
            reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("ReportDataSource", dtclone));
            reportViewer1.RefreshReport();
    


    Hello all.

    This codes is making;

    user is select an excel file, and give an filter it is "Durum" then datagrid is fill for this filter.

    And last, printout this result for printer. But reportviewer does not see the report. What can i do ?

    Thanks all.

    • Moved by Aspen VJ Monday, June 20, 2011 7:58 AM (From:Visual C# General)
    Saturday, June 18, 2011 1:45 PM

All replies