Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Bind ReportViwer to DataSource dynamically

Bind ReportViwer to DataSource dynamically

Scheduled Pinned Locked Moved C#
csharpwinformshelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Software2007
    wrote on last edited by
    #1

    I spent 4 hours :mad: trying to get a simple report rdlc to display with no success. I keep getting this error "a data source instance has not been supplied for DataSet1" To make it simple, I tried to bind with simple arraylist In Winforms-(VS2010) -I created DataSet with a table of 2 columns(Firstname,LastName) - I created report1.rdlc with a table (2 Columns) from the DataSet Note I can bind statically on page load, but I need to bind dynamically like below.

    void OnClick()
    {
    ArrayList arr = new ArrayList();
    arr.Add("Tim","Duncan");
    arr.Add("Babe","Ruth");

    ReportViewer1.ProcessingMode = ProcessingMode.Local;
    ReportViewer1.LocalReport.ReportPath = "Report1.rdlc";
    ReportDataSource drs = new ReportDataSource("DataSet1, arr);
    ReportViewer1.LocalReport.DataSources.Clear();
    ReportViewer1.LocalReport.DataSources.Add(drs);
    ReportViewer1.RefreshReport();
    }

    P 1 Reply Last reply
    0
    • S Software2007

      I spent 4 hours :mad: trying to get a simple report rdlc to display with no success. I keep getting this error "a data source instance has not been supplied for DataSet1" To make it simple, I tried to bind with simple arraylist In Winforms-(VS2010) -I created DataSet with a table of 2 columns(Firstname,LastName) - I created report1.rdlc with a table (2 Columns) from the DataSet Note I can bind statically on page load, but I need to bind dynamically like below.

      void OnClick()
      {
      ArrayList arr = new ArrayList();
      arr.Add("Tim","Duncan");
      arr.Add("Babe","Ruth");

      ReportViewer1.ProcessingMode = ProcessingMode.Local;
      ReportViewer1.LocalReport.ReportPath = "Report1.rdlc";
      ReportDataSource drs = new ReportDataSource("DataSet1, arr);
      ReportViewer1.LocalReport.DataSources.Clear();
      ReportViewer1.LocalReport.DataSources.Add(drs);
      ReportViewer1.RefreshReport();
      }

      P Offline
      P Offline
      preetham gd
      wrote on last edited by
      #2

      ReportDataSource drs = new ReportDataSource("DataSet1, arr); have you missed " after DataSet1 here ReportDataSource drs = new ReportDataSource("DataSet1", arr);

      S 1 Reply Last reply
      0
      • P preetham gd

        ReportDataSource drs = new ReportDataSource("DataSet1, arr); have you missed " after DataSet1 here ReportDataSource drs = new ReportDataSource("DataSet1", arr);

        S Offline
        S Offline
        Software2007
        wrote on last edited by
        #3

        I wish I have. It's a typo while copying to the forum. Do you know if there is any simple working sample source code that I can download, then I can work backwards from there. I have tried several things I found on net, including binding to different datasources, like Datasets from Database, only works statically, but not dynamically. Any help would be appreciated.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups