Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I suppose you are using the Report Viewer in local mode: </p> <pre><code>viewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local </code></pre> <p>and you use <code>viewer.LocalReport</code>. In this case you has to run query yourself and pass the result to the viewer:</p> <pre><code>dim tbl as new DataTable() </code></pre> <p>Fill the data e.g. tbl.load(datareader).</p> <pre><code>Dim VDS As New ReportDataSource VDS.Name = "Your Data Source Name" VDS.Value = tbl viewer.LocalReport.DataSources.Add(VDS) </code></pre> <p>If you want to use server mode</p> <pre><code>viewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote </code></pre> <p>You has to use <code>viewer.ServerReport</code></p> <pre><code>viewer.ServerReport.ReportServerUrl = New Uri(ReportServerURL) </code></pre> <p>and probably <code>viewer.ServerReport.SetDataSourceCredentials</code></p> <p><a href="http://msdn.microsoft.com/en-us/library/ms345248.aspx" rel="noreferrer">Reporting Services and ReportViewer Controls in Visual Studio</a></p> <p><strong>Edit</strong><br> <strong>How to get queries from rdl</strong><br> Initialization:</p> <pre><code>Dim XRep As New XmlDocument XRep.Load(ReportPath) Dim xmlnsManager As New System.Xml.XmlNamespaceManager(XRep.NameTable) dim DefaultNSURI as string = XRep.GetElementsByTagName("Width")(0).NamespaceURI xmlnsManager.AddNamespace("rep", DefaultNSURI) </code></pre> <p>Dataset Processing:</p> <pre><code>For Each nd As XmlNode In XRep.SelectNodes("/rep:Report/rep:DataSets/rep:DataSet", xmlnsManager) 'DataSourceName can be used to find iformation about connection' Dim DataSourceName As String = nd.SelectSingleNode("rep:Query/rep:DataSourceName", xmlnsManager).InnerText Dim DSName As String = nd.Attributes("Name").Value cmd.CommandText = nd.SelectSingleNode("rep:Query/rep:CommandText", xmlnsManager).InnerText Dim tbl As New DataTable(DSName) tbl.Load(cmd.ExecuteReader) 'The table created here is to be passed to LocalReport as datasource' Next </code></pre> <p>Note To convert vb.net&lt;->c# I use <a href="http://www.developerfusion.com/tools/convert/vb-to-csharp/" rel="noreferrer">Convert VB.NET to C#</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload