簡體   English   中英

找不到合適的方法來覆蓋錯誤

[英]No Suitable Method Found To Override error

如何解決這個問題?

錯誤 2 'School_Software.RptStudents.NewGenerator':找不到合適的方法來覆蓋 C:\\Users\\user\\Downloads\\Compressed\\school_software_0\\School Software\\School Software\\RptStudents.cs 33 31 學校軟件

下面是我的代碼

namespace School_Software {

public class RptFinalMarksLedger : ReportClass {

    public RptFinalMarksLedger() {
    }

    public override string ResourceName {
        get {
            return "RptFinalMarksLedger.rpt";
        }
        set {
            // Do nothing
        }
    }

    public override bool NewGenerator {
        get {
            return true;
        }
        set {
            // Do nothing
        }
    }

    public override string FullResourceName {
        get {
            return "School_Software.RptFinalMarksLedger.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 CachedRptFinalMarksLedger : Component, ICachedReport {

    public CachedRptFinalMarksLedger() {
    }

    [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() {
        RptFinalMarksLedger rpt = new RptFinalMarksLedger();
        rpt.Site = this.Site;
        return rpt;
    }

    public virtual string GetCustomizedCacheKey(RequestContext request) {
        String key = null;

        return key;
    }
}

}

您正在嘗試覆蓋未在基類中定義的屬性 ( NewGenerator )。

只需刪除override關鍵字:

public bool NewGenerator {
    get {
        return true;
    }
    set {
        // Do nothing
    }
}
 public class CADExpertInitalizeDB : DropCreateDatabaseIfModelChanges <CADExpertContext>
    {
        protected  override void Seed(CADExpertContext context)
        {
            context.CADExperts.Add(new CADExpert { Id = 1, Name = "Rice", inStock = true, Price = 30 });
            context.CADExperts.Add(new CADExpert { Id = 2, Name = "Sugar", inStock = false, Price = 40 });
            context.SaveChanges();
            base.Seed(context);
        }
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM