siri Posted November 21, 2007 Share Posted November 21, 2007 Using VS designer 2005 for reports (rdlc), I create the report, then create a Data Source, then drag the Data Source fields onto the report. Click f5, it runs great.******************************************************To run this report from my code, I have the following in Page_Load: DataSet ds = new DataSet(); DataTable myTable = new DataTable(); myTable.Columns.Add("x1", Type.GetType("System.String")); myTable.Columns.Add("x2", Type.GetType("System.String")); myTable.Columns.Add("x3", Type.GetType("System.String")); ds.Tables.Add(myTable); this.ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("ReportsSharedDataSource", myTable));This DataTable has the same definition as the Data Source table.This should show my report, but is giving error:"A data source instance has not been supplied for the data source 'DataSet1_Table1'." Is my approach at first designing the report with a Data Source a good one? Is there a better way?Thanks Link to comment Share on other sites More sharing options...
aspnetguy Posted November 21, 2007 Share Posted November 21, 2007 try this instead this.ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("ReportsSharedDataSource", ds)); Supply the DataSet instead of the DataTable Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.