Solved

crystal reports c# winforms problem

Posted on 2013-01-28
6
1,016 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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 …
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now