<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Reporting</title>
        <link>http://blogs.ugidotnet.org/PietroLibroBlog/category/3288.aspx</link>
        <description>Reporting</description>
        <language>it-IT</language>
        <copyright>Pietro Libro</copyright>
        <managingEditor>pietro.libro@jumpy.it</managingEditor>
        <generator>Subtext Version 2.0.0.43</generator>
        <item>
            <title>Report Locali &amp;amp; ReportDataSource</title>
            <link>http://blogs.ugidotnet.org/PietroLibroBlog/archive/2008/04/15/92210.aspx</link>
            <description>&lt;p&gt;Post nato da una discussione su forum. Supponiamo di avere un DataSet tipizzato contenente un oggetto DataTable "Articoli" come in figura:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/ReportLocaliReportDataSource_BE2B/DataSet_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="180" alt="DataSet" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/ReportLocaliReportDataSource_BE2B/DataSet_thumb.jpg" width="244" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Supponiamo di avere anche un report locale del tipo:&lt;/p&gt;  &lt;p&gt; &lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/ReportLocaliReportDataSource_BE2B/Immagine_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="88" alt="Immagine" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/ReportLocaliReportDataSource_BE2B/Immagine_thumb.jpg" width="244" border="0" /&gt;&lt;/a&gt;  &lt;/p&gt;  &lt;p&gt;Per associare il nostro DataTable al report, possiamo utilizzare un ReportDataSource, scrivendo del codice tipo:&lt;/p&gt;  &lt;p&gt;   &lt;/p&gt;&lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:bb5281b8-20d3-4902-8121-996bee9e2a1d" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color:White;white-space:-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #008080;"&gt; 1&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Dim&lt;/span&gt;&lt;span style="color: #000000;"&gt; dsStampa &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;New&lt;/span&gt;&lt;span style="color: #000000;"&gt; DsStampa()
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 2&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Dim&lt;/span&gt;&lt;span style="color: #000000;"&gt; tableArticoli &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;New&lt;/span&gt;&lt;span style="color: #000000;"&gt; DsStampa.ArticoliDataTable()
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 3&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 4&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #008000;"&gt;'&lt;/span&gt;&lt;span style="color: #008000;"&gt;Aggiungo un paio di righe&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 5&lt;/span&gt; &lt;span style="color: #008000;"&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Dim&lt;/span&gt;&lt;span style="color: #000000;"&gt; articoloRow &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; DsStampa.ArticoliRow &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; tableArticoli.NewArticoliRow()
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 6&lt;/span&gt; &lt;span style="color: #000000;"&gt;        articoloRow.Codice &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;CODICE A&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 7&lt;/span&gt; &lt;span style="color: #000000;"&gt;        articoloRow.Descrizione &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt; DESCRIZIONE 1&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 8&lt;/span&gt; &lt;span style="color: #000000;"&gt;        tableArticoli.Rows.Add(articoloRow)
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 9&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;10&lt;/span&gt; &lt;span style="color: #000000;"&gt;        articoloRow &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; tableArticoli.NewArticoliRow()
&lt;/span&gt;&lt;span style="color: #008080;"&gt;11&lt;/span&gt; &lt;span style="color: #000000;"&gt;        articoloRow.Codice &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;CODICE B&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;12&lt;/span&gt; &lt;span style="color: #000000;"&gt;        articoloRow.Descrizione &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt; DESCRIZIONE 2&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;13&lt;/span&gt; &lt;span style="color: #000000;"&gt;        tableArticoli.Rows.Add(articoloRow)
&lt;/span&gt;&lt;span style="color: #008080;"&gt;14&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;15&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Dim&lt;/span&gt;&lt;span style="color: #000000;"&gt; reportDataSource &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;New&lt;/span&gt;&lt;span style="color: #000000;"&gt; Microsoft.Reporting.WinForms.ReportDataSource()
&lt;/span&gt;&lt;span style="color: #008080;"&gt;16&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;17&lt;/span&gt; &lt;span style="color: #000000;"&gt;        reportDataSource.Name &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;DsStampa_Articoli&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;18&lt;/span&gt; &lt;span style="color: #000000;"&gt;        reportDataSource.Value &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; tableArticoli
&lt;/span&gt;&lt;span style="color: #008080;"&gt;19&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;20&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Me&lt;/span&gt;&lt;span style="color: #000000;"&gt;.ReportViewer1.LocalReport.ReportPath &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;Report1.rdlc&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;21&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Me&lt;/span&gt;&lt;span style="color: #000000;"&gt;.ReportViewer1.LocalReport.DataSources.Clear()
&lt;/span&gt;&lt;span style="color: #008080;"&gt;22&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Me&lt;/span&gt;&lt;span style="color: #000000;"&gt;.ReportViewer1.LocalReport.DataSources.Add(reportDataSource)
&lt;/span&gt;&lt;span style="color: #008080;"&gt;23&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Me&lt;/span&gt;&lt;span style="color: #000000;"&gt;.ReportViewer1.RefreshReport()&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;


&lt;p&gt;E' importante non sbagliare ad impostare la stringa della proprietà &lt;em&gt;Name &lt;/em&gt;della nostra istanza di reportDataSource con il valore presente nelle proprietà &lt;em&gt;Table&lt;/em&gt; del report&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/ReportLocaliReportDataSource_BE2B/Immagine_4.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="233" alt="Immagine" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/ReportLocaliReportDataSource_BE2B/Immagine_thumb_1.jpg" width="244" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;altrimenti all'interno del ReportViewer verrebbe notificato un errore che indica che non è stata fornita nessuna sorgente dati&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/ReportLocaliReportDataSource_BE2B/Immagine1_2.jpg"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="139" alt="Immagine1" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/ReportLocaliReportDataSource_BE2B/Immagine1_thumb.jpg" width="244" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Codice sorgente: &lt;a href="http://www.pietrolibro.name/sources/test report.zip" target="_blank"&gt;Test Report.zip&lt;/a&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;
  &lt;/p&gt;&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:68c2e4ac-e02e-4115-ba67-f1fd2603a1a4" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tag: &lt;a href="http://technorati.com/tags/ReportDataSource" rel="tag"&gt;ReportDataSource&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/PietroLibroBlog/aggbug/92210.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pietro Libro</dc:creator>
            <guid>http://blogs.ugidotnet.org/PietroLibroBlog/archive/2008/04/15/92210.aspx</guid>
            <pubDate>Tue, 15 Apr 2008 09:07:50 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/PietroLibroBlog/archive/2008/04/15/92210.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/PietroLibroBlog/comments/commentRss/92210.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/PietroLibroBlog/services/trackbacks/92210.aspx</trackback:ping>
        </item>
    </channel>
</rss>