Report viewer without database connection RRS feed

  • Question



       My report viewer works fine if i specify databasec connection and create a dataset with table from database.But wht iam trying to do is iam getting a string of values which i need to convert it to dataset by declaring columns in code.Then i need to display the report with the availabe data in dataset.Currently i created a xsd and able to drag columns to the table in rlc file.

    DataSet ds1 = new DataSet();

    ds1 = GetVlaues(); 

     DataTable1BindingSource.DataSource = ds1;


    THis is the code iam using in form load event.Iam getting runtime error as a datasource instance as not been supplied for datasource.


     Thank you

    Monday, December 31, 2007 6:24 PM

All replies


    if your using an RDLC file, you need to change a few things.  Primarily you need to make sure you hand your repot a datasource with the same name as the datasource you used to create the .rdl or .rdlc file.  Then besides that you need to set the repordatasource to the correct table in the dataset, not just the whole dataset


    DataSet ReportDataSet = new DataSet();

    //Fill report Dataset here

    ReportDataSource customReportData = new ReportDataSource();


    customReportData.Name = "ReportDataset_ReportData1";//this name must match the dataset name used when you created the .rdlc file

    customReportData.Value = ReportDataSet.Tables[0];



    ReportViewer1.LocalReport.DataSources.Add(customReportData);//pass the reportviewer our datasources


    ReportViewer1.LocalReport.DisplayName = "Report Name";//assigns the name of the report, used primarily when exporting






    Wednesday, January 2, 2008 8:48 PM