aanewsjmde
New Member
I built a very simple report (.rdl) in ReportBuilder 3.0. It has a connection to my database, and gets city out of the address field.\[code\]SELECT TOP 10 City, COUNT(City) FROM [MYDB].[dbo].[ResidentialAddress] WHERE StateName = 'WA' OR StateName = 'Washington' GROUP BY City ORDER BY COUNT(City) DESC\[/code\]This works in ReportBuilder. I save and close. Then I try to open and view the report in VS 2010 via MicroSoft.Reporting.WebForms.ReportViewer. I can load a completely blank RDL file (text only) in my c#/ASP.NET website locally.\[code\] this.MyReportViewer.Reset(); this.MyReportViewer.ProcessingMode = ProcessingMode.Local; this.MyReportViewer.AsyncRendering = false; this.MyReportViewer.LocalReport.LoadReportDefinition(new StreamReader("H:\\DataReportsViewer\\DataReportsViewer\\" + RDLFileList.SelectedValue)); this.MyReportViewer.LocalReport.ReportPath = RDLFileList.SelectedValue; this.MyReportViewer.ShowReportBody = true; this.MyReportViewer.LocalReport.Refresh();\[/code\]However, as soon as I add a chart, I get this error:\[quote\] A data source instance has not been supplied for the data source 'DataSet1'.\[/quote\]It doesn't make sense to me, because when I open up the RDL file, the connection string and query are there, seemingly as they should be.\[code\]<DataSources> <DataSource Name="DataSource1"> <ConnectionProperties> <DataProvider>SQL</DataProvider> <ConnectString>Data Source=MYSERVER;Initial Catalog=Ad_Dev</ConnectString> <IntegratedSecurity>true</IntegratedSecurity> </ConnectionProperties> <rd:SecurityType>Integrated</rd:SecurityType> <rdataSourceID>350f6976-9402-43fd-b8f8-8f809f116f84</rdataSourceID> </DataSource> </DataSources> <DataSets> <DataSet Name="DataSet1"> <Query> <DataSourceName>DataSource1</DataSourceName> <CommandText>SELECT TOP 10 ResidentialAddress.City,COUNT(ResidentialAddress.City)FROM ResidentialAddressWHERE StateName = 'WA'GROUP BY ResidentialAddress.CityORDER BY COUNT(ResidentialAddress.City)</CommandText> <rd:UseGenericDesigner>true</rd:UseGenericDesigner> </Query> <Fields> <Field Name="City"> <DataField>City</DataField> <rd:TypeName>System.String</rd:TypeName> </Field> <Field Name="ID"> <DataField /> <rd:TypeName>System.Int32</rd:TypeName> </Field> </Fields> </DataSet> </DataSets>\[/code\]So, I attempted the workaround in my c# code:\[code\] //Added line: TestDataSource runs same query and returns correctly loaded DataTable ReportDataSource reportDataSource = new ReportDataSource("DataSet1", TestDataSource()); this.MyReportViewer.LocalReport.DataSources.Add(reportDataSource);\[/code\]And that runs, but no data shows up. I can't win! Any ideas? Are SSRS and ASP.NET just not meant to play with each other? I was hoping to make a local test version of this report viewer, but I've already had to make a lot of hacks to even get the blank report to run locally.