Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SSRS Report Viewer doesn't detect datasource?
- SELECT TOP 10 City, COUNT(City) FROM [MYDB].[dbo].[ResidentialAddress] WHERE StateName = 'WA' OR StateName = 'Washington' GROUP BY City ORDER BY COUNT(City) DESC
- 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();
- <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>
- <rd:DataSourceID>350f6976-9402-43fd-b8f8-8f809f116f84</rd:DataSourceID>
- </DataSource>
- </DataSources>
- <DataSets>
- <DataSet Name="DataSet1">
- <Query>
- <DataSourceName>DataSource1</DataSourceName>
- <CommandText>SELECT TOP 10 ResidentialAddress.City,COUNT(ResidentialAddress.City)
- FROM ResidentialAddress
- WHERE StateName = 'WA'
- GROUP BY ResidentialAddress.City
- ORDER 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>
- //Added line: TestDataSource runs same query and returns correctly loaded DataTable
- ReportDataSource reportDataSource = new ReportDataSource("DataSet1", TestDataSource());
- this.MyReportViewer.LocalReport.DataSources.Add(reportDataSource);
Add Comment
Please, Sign In to add comment