Caricare 2 dfferenti report in Microsoft ReportViewer

by enrico 9. March 2009 19:11

Non so se ha te è capitato di dover caricare diversi Report fatti con il tool di Microsoft e vedersi restituire degli errori di vario tipo. Ad esempio a me è capitato che due report aventi parametri diversi mi creavano dei problemi quando li andavo a visualizzare.

Per poter risolvere il problema è necessario effettuare un refresh del report poiché sembra che il ReportViewer tenga in memoria le informazioni del report definiti durante la creazione in design-time.

Per poter risolvere il problema si possono utilizzare le seguenti righe di codice:

   1: Dim rds As Microsoft.Reporting.WinForms.ReportDataSource = New Microsoft.Reporting.WinForms.ReportDataSource
   2: Me.ReportViewer1.Reset()
   3: Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "report.rdlc"
   4: Me.ReportViewer1.LocalReport.DataSources.Clear()
   5: rds.Name = "nome_dataset_del_report"
   6: rds.Value = Me.CommesseAttivitaBindingSource
   7: Me.ReportViewer1.LocalReport.DataSources.Add(rds)

Buon lavoro!

P. S.: abbiamo creato il nostro forum per poter rispondere alle vostre domande. Utilizzatelo numerosi! Grazie

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

report | vb.net | Tricks & Tips | Work around | windowsform

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by Esia Software 1.4.0.0

Informazioni sull'autore

Sono un cittadini di Trieste, ho 33 anni e faccio lo sviluppatore nella mia azienda che si chiama Esia Software.

Commenti recenti

Comment RSS

Post recenti

Calendar

<<  May 2012  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

Info legali

Le opinioni espresse in questo blog sono strettamente personali e ogni persona è responsabile dei commenti che inserisce.

RecentComments

Comment RSS