none
Wrrrrrrrrrr ... that ReportViewer !!! RRS feed

  • Question

  • I still can't get it !

    Now I got a new error message:

    An error occurred during local report processing.
    The report definition for report 'PSA_C5_Statistik.1_Periodestatistik.Report_Periodestatistik.rdlc' has not been specified

    And I HAVE a
    report object with the name Report_Periodestatistik.rdlc
    in a folder named 1_Periodestatistik
    in my project called PSA_C5_Statistik

    What do I miss here ?

    - here is my code:

    1 namespace PSA_C5_Statistik._1_Periodestastistik  
    2 {  
    3     public partial class Form_VisPeriodeStatistik : Form  
    4     {  
    5         private List<ParaTilPerStat> pStat = new List<ParaTilPerStat>();  
    6         private ParaTilPerStat paraTilPerStat;  
    7  
    8         public Form_VisPeriodeStatistik(ParaTilPerStat P)  
    9         {  
    10             InitializeComponent();  
    11             pStat.Add(P);  
    12  
    13         }  
    14  
    15         private void Form_VisPeriodestatistik_Load(object sender, EventArgs e)  
    16         {  
    17             this.reportViewer1.LocalReport.DataSources.Clear();  
    18             this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet_PeriodeStat_DataSet_PeriodeStat", pStat));  
    19  
    20             this.reportViewer1.RefreshReport();  
    21         }  
    22     }  
    23



    Best regards
    KSor, Denmark

    Friday, September 19, 2008 7:09 AM

All replies

  • Hi
       There is a chance that error that you described is because you changed option 'build action' of your .rdlc file to other then 'Embedded Resource' and didn't change .

       You can set report definition in two ways. First you can use embedded resources (your report definition file option 'build action' must be 'Embedded Resource'):
    this.reportViewer1.LocalReport.ReportEmbeddedResource = "MyApp.Report2.rdlc"
       Second way is to to set proper report definition file path like this:
    this.reportViewer1.LocalReport.ReportPath = Application.StartupPath + @"\Report2.rdlc"

    In second way remember to change 'copy to output' option of your report file to 'copy always' (ofc you can set different path to your .rdlc file - this.reportViewer1.LocalReport.ReportPath = Application.StartupPath + @"\1_Periodestatistik\Report_Periodestatistik.rdlc").

    everything is a matter of probability...
    Friday, September 19, 2008 11:43 AM
  • It will NOT work !

    I now have deleted my original report and added a new one - Report1.rdlc - with default settings "Embedded Resource" and the same error comes up - except the name of the report.

    Best regards
    KSor, Denmark
    Friday, September 19, 2008 12:05 PM
  • System.IO.FileInfo fi = new FileInfo(Application.StartupPath + @"\1_Periodestatistik\Report_Periodestatistik.rdlc");
    if (!fi.Exists) MessageBox.Show("RDLC file not exists");
    this.reportViewer1.LocalReport.ReportPath = Application.StartupPath + @"\1_Periodestatistik\Report_Periodestatistik.rdlc";

    Put this code before refreshing your report viewer. It will check if RDLC file exists.

    Also write when are you getting this error? Is it just after your app starts or after some interaction like button click?

    everything is a matter of probability...
    Friday, September 19, 2008 12:31 PM
  • Adapting to my new situation with the newly added Report1.rdlc:

    System.IO.FileInfo fi = new FileInfo(Application.StartupPath + @"\1_Periodestatistik\Report1.rdlc");
    if (!fi.Exists) MessageBox.Show("RDLC file not exists");
    this.reportViewer1.LocalReport.ReportPath = Application.StartupPath + @"\1_Periodestatistik\Report1.rdlc";

    the messagebox with "RDLC file not exists" comes up !

    If I copy the "Full path" of the Report1 file it's:

    C:\Documents and Settings\kso\Dokumenter\Visual Studio 2008\Projects\PSA_C5_Statistik\PSA_C5_Statistik\1_Periodestastistik\Report1.rdlc

    And here I wonder why ...PSA_C5_Statistik\PSA_C5_Statistik\.... the repeating  ????????

    And more... I can see that the TOP line i the Solution explorer is NOT a "project line" but just an icon with C# and the text "PSA_C5_Statistik" - where is the "project line" ???????

    I think my whole project is corrupted .... or ?

    Best regards
    KSor, Denmark

    Friday, September 19, 2008 12:52 PM
  • Ummm.....one thing, is this full path really correct? Because in it is '1_Periodestastistik' but earlier we ware using '1_Periodestatistik', maybe problem is in here?

    everything is a matter of probability...
    Friday, September 19, 2008 1:02 PM
  • I'm shure there IS a problem here - I have started all over 3-4 times - and there same problem did come up ... the repeating of some peace of the path to the report file !

    I think the problem comes up when you are using folders OR when the folder names is starting with digits OR when the LENGTH of the paths is getting "too" long - how much "too" long is I don't know - I don't think I'm even close to 256 but maybe some "internal" paths is getting "too" long when I'm using "long" paths.

    I have noticed too that RENAMING of FOLDERs in a project can make problems too - but yet I can't say how and when it goes wrong !


    Best regards KSor, Denmark
    • Edited by Ksor Saturday, September 20, 2008 5:05 AM spelling
    Saturday, September 20, 2008 4:59 AM