?
Solved

crystal reports c# winforms problem

Posted on 2013-01-28
6
Medium Priority
?
1,102 Views
Last Modified: 2013-02-03
Hi

I am incorporating some crystal reports into my c# 2010 app, and when I add the reports all is fine.  but if I go back to the report in design view and edit it, it goes a bit funky and I start getting compiler errors...

Error      3      The call is ambiguous between the following methods or properties: 'WindowsFormsApplication2.CrystalReport1.CrystalReport1()' and 'WindowsFormsApplication2.CrystalReport1.CrystalReport1()'      C:\Documents and Settings\User\my documents\visual studio 2010\Projects\WindowsFormsApplication2\WindowsFormsApplication2\CrystalReport11.cs      132      34      WindowsFormsApplication2

any ideas what is going on?  I am starting to get a dislike for crystal reports!

CD
0
Comment
Question by:cycledude
  • 4
6 Comments
 
LVL 18

Assisted Solution

by:vasto
vasto earned 2000 total points
ID: 38827118
You have 2 methods with the same name and parameters. Double click on each of the messages and check each of the methods.
0
 

Author Comment

by:cycledude
ID: 38827199
hi

but why would crystal reports be adding duplicated code? you would think they would  want to avoid doing this, wouldn't you?

It's not something that I have changed in the code, and the errors are in the 'CrystalReport2' file... code is here:

(I removed the original crystalreport1, and added a crystalreport2, for which I am getting the same error as originally posted)


//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.296
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace WindowsFormsApplication2 {
    using System;
    using System.ComponentModel;
    using CrystalDecisions.Shared;
    using CrystalDecisions.ReportSource;
    using CrystalDecisions.CrystalReports.Engine;
    
    
    public class CrystalReport2 : ReportClass {
        
        public CrystalReport2() {
        }
        
        public override string ResourceName {
            get {
                return "CrystalReport2.rpt";
            }
            set {
                // Do nothing
            }
        }
        
        public override bool NewGenerator {
            get {
                return true;
            }
            set {
                // Do nothing
            }
        }
        
        public override string FullResourceName {
            get {
                return "WindowsFormsApplication2.CrystalReport2.rpt";
            }
            set {
                // Do nothing
            }
        }
        
        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public CrystalDecisions.CrystalReports.Engine.Section Section1 {
            get {
                return this.ReportDefinition.Sections[0];
            }
        }
        
        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public CrystalDecisions.CrystalReports.Engine.Section Section2 {
            get {
                return this.ReportDefinition.Sections[1];
            }
        }
        
        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public CrystalDecisions.CrystalReports.Engine.Section Section3 {
            get {
                return this.ReportDefinition.Sections[2];
            }
        }
        
        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public CrystalDecisions.CrystalReports.Engine.Section Section4 {
            get {
                return this.ReportDefinition.Sections[3];
            }
        }
        
        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public CrystalDecisions.CrystalReports.Engine.Section Section5 {
            get {
                return this.ReportDefinition.Sections[4];
            }
        }
    }
    
    [System.Drawing.ToolboxBitmapAttribute(typeof(CrystalDecisions.Shared.ExportOptions), "report.bmp")]
    public class CachedCrystalReport2 : Component, ICachedReport {
        
        public CachedCrystalReport2() {
        }
        
        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public virtual bool IsCacheable {
            get {
                return true;
            }
            set {
                // 
            }
        }
        
        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public virtual bool ShareDBLogonInfo {
            get {
                return false;
            }
            set {
                // 
            }
        }
        
        [Browsable(false)]
        [DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
        public virtual System.TimeSpan CacheTimeOut {
            get {
                return CachedReportConstants.DEFAULT_TIMEOUT;
            }
            set {
                // 
            }
        }
        
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() {
            CrystalReport2 rpt = new CrystalReport2();
            rpt.Site = this.Site;
            return rpt;
        }
        
        public virtual string GetCustomizedCacheKey(RequestContext request) {
            String key = null;
            // // The following is the code used to generate the default
            // // cache key for caching report jobs in the ASP.NET Cache.
            // // Feel free to modify this code to suit your needs.
            // // Returning key == null causes the default cache key to
            // // be generated.
            // 
            // key = RequestContext.BuildCompleteCacheKey(
            //     request,
            //     null,       // sReportFilename
            //     this.GetType(),
            //     this.ShareDBLogonInfo );
            return key;
        }
    }
}

Open in new window

0
 
LVL 101

Expert Comment

by:mlmcc
ID: 38829546
What version of Crystal are you trying to use?

Do you have 2 versions of Crystal installed on the machine?

If so, did you accidentally include assemblies or references from both?

mlmcc
0
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 

Author Comment

by:cycledude
ID: 38830105
Hi

No, only one version installed and it was the free one for use with vs2010
0
 

Accepted Solution

by:
cycledude earned 0 total points
ID: 38830486
I have got to the bottom of it...

The problem occurs when I have the report, and try to run the application before saving is completed...  I get a message saying could not save file xxx.xxx due to no access (or something along those lines) then crystal reports creates a new file eg 'CrystalReports21.cs'

so effectively doubling up the definitions... I delete the newly created 'CrystalReports21.cs' (the name of the file will be dependent on the name of your report) and all is well
0
 

Author Closing Comment

by:cycledude
ID: 38848244
weird one... but got it sorted eventually!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question