SHARE
TWEET

Untitled

a guest Jan 12th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SSRS Report Viewer doesn't detect datasource?
  2. SELECT TOP 10 City, COUNT(City) FROM [MYDB].[dbo].[ResidentialAddress] WHERE StateName = 'WA' OR StateName = 'Washington' GROUP BY City ORDER BY COUNT(City) DESC
  3.    
  4. this.MyReportViewer.Reset();
  5.             this.MyReportViewer.ProcessingMode = ProcessingMode.Local;
  6.             this.MyReportViewer.AsyncRendering = false;
  7.             this.MyReportViewer.LocalReport.LoadReportDefinition(new StreamReader("H:\DataReportsViewer\DataReportsViewer\" + RDLFileList.SelectedValue));
  8.             this.MyReportViewer.LocalReport.ReportPath = RDLFileList.SelectedValue;          
  9.             this.MyReportViewer.ShowReportBody = true;
  10.             this.MyReportViewer.LocalReport.Refresh();
  11.    
  12. <DataSources>
  13.     <DataSource Name="DataSource1">
  14.       <ConnectionProperties>
  15.         <DataProvider>SQL</DataProvider>
  16.         <ConnectString>Data Source=MYSERVER;Initial Catalog=Ad_Dev</ConnectString>
  17.         <IntegratedSecurity>true</IntegratedSecurity>
  18.       </ConnectionProperties>
  19.       <rd:SecurityType>Integrated</rd:SecurityType>
  20.       <rd:DataSourceID>350f6976-9402-43fd-b8f8-8f809f116f84</rd:DataSourceID>
  21.     </DataSource>
  22.   </DataSources>
  23.   <DataSets>
  24.     <DataSet Name="DataSet1">
  25.       <Query>
  26.         <DataSourceName>DataSource1</DataSourceName>
  27.         <CommandText>SELECT TOP 10 ResidentialAddress.City,COUNT(ResidentialAddress.City)
  28. FROM ResidentialAddress
  29. WHERE StateName = 'WA'
  30. GROUP BY ResidentialAddress.City
  31. ORDER BY COUNT(ResidentialAddress.City)</CommandText>
  32.         <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
  33.       </Query>
  34.       <Fields>
  35.         <Field Name="City">
  36.           <DataField>City</DataField>
  37.           <rd:TypeName>System.String</rd:TypeName>
  38.         </Field>
  39.         <Field Name="ID">
  40.           <DataField />
  41.           <rd:TypeName>System.Int32</rd:TypeName>
  42.         </Field>
  43.       </Fields>
  44.     </DataSet>
  45.   </DataSets>
  46.    
  47. //Added line: TestDataSource runs same query and returns correctly loaded DataTable
  48.             ReportDataSource reportDataSource = new ReportDataSource("DataSet1", TestDataSource());
  49.             this.MyReportViewer.LocalReport.DataSources.Add(reportDataSource);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top