Solved

crystal reports c# winforms problem

Posted on 2013-01-28
6
1,040 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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 …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

860 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