Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am creating a console application wherin i created two class files Edi837GeneratorBase.cs and BlueGrassReportingGenerator.cs

In Edi837GeneratorBase.cs

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SCS.SNDS.PH.EdiExport.DataAccess.LinqToSql;
using System.IO;
using SCS.SNDS.PH.EdiExport.X12Edi837Ver5010;
using SCS.SNDS.PH.EdiExport;
using System.Data.Common;
namespace SCS.SNDS.PH.Edi837GeneratorConsole
{
    public class Edi837GeneratorBase : IEdiGenerator
    {
        public Edi837GeneratorBase(string groupID,DateTime startDate,DateTime endDate)
        {
            context = new X12837DataContext();
            context.CommandTimeout = 240;
            context.Connection.Open();
            transaction = context.Connection.BeginTransaction();
            context.Transaction = transaction;
            Container.SetupContainer(context);
            submissionGroupID = groupID;
            startDate = this.startDate;
            endDate = this.endDate;
            outWorker = GetOutworker();
        }
       
    }

}


Now, i have class BlueGrassReportingGenerator.cs

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SCS.SNDS.PH.EdiExport.DataAccess.LinqToSql;
using System.Data.Common;
using System.Data;
using System.IO;
using SCS.SNDS.PH.EdiExport.X12Edi837Ver5010;
using SCS.SNDS.PH.EdiExport;
namespace SCS.SNDS.PH.Edi837GeneratorConsole
{
    public class BlueGrassReportingGenerator : Edi837GeneratorBase
    {
        public BlueGrassReportingGenerator() : base(Properties.Settings.Default.BlueGrassReportingSubGroupID, startDate, endDate)
        {
        }
    }
}


i am trying to access the Edi837GeneratorBase in Edi837GeneratorBase.cs Class from BluegrassReportingGenerator.cs class but i am getting an error and thestart Date and Date time are underlined with red line

Error 84 An object reference is required for the non-static field, method, or property


Could anyone please help me to how to access this.

Thanks in advance
Anupama
Posted

1 solution

startDate, endDate arguments are required by the Edi837GeneratorBase constructor, hence you must pass valid DateTime objects there. You might modify the BlueGrassReportingGenerator constructor this way:

C#
public BlueGrassReportingGenerator(DateTime startDate, DateTime endDate) : base(Properties.Settings.Default.BlueGrassReportingSubGroupID, startDate, endDate)
//...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900