Solved

crystal reports c# winforms problem

Posted on 2013-01-28
6
1,035 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 500 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 100

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
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Suggested Solutions

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. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

770 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