Problems calling FillByPrimaryKey method of a BO


Author
Message
Marcia G Akins
Marcia G Akins
Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
Hi All.

I am baffled. I must be doing something stupid.

This line of code:

boSchedule_hdr.FillByPrimaryKey(tiSchedHdr_id);

gives me this error:

Error 1 An object reference is required for the non-static field, method, or property 'MicroFour.StrataFrame.Business.BusinessLayer.FillByPrimaryKey(int)' F:\TGIF\Libs\HandicapCalculator.cs 14 13 TGIF

This line of code:

boCalcPar.GetLast3Scores(Convert.ToDateTime(boSchedule_hdr.play_dte.ToString()), tiPerson_id);

gives me this error:

Error 2 An object reference is required for the non-static field, method, or property 'TGIF.BusinessObject.boSchedule_hdr.play_dte.get' F:\TGIF\Libs\HandicapCalculator.cs 36 57 TGIF

but this line of code works just fine:

boPerson.FillByPrimaryKey(tiPerson_id);

Also, the lines of code that are causing errors now worked just fine in the form where they were originally. I am trying to abstract the form method into a class of its own because I now need this functionality from multiple places.

Any ideas are greatly appreciated.

TIA.

Marcia


Marcia G Akins
Marcia G Akins
Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)Advanced StrataFrame User (500 reputation)
Group: StrataFrame Users
Posts: 322, Visits: 529
That was it. I was doing something stupid Smile

I was instantiating the BO like this:

boSchedule_hdr boSchedule_hdr = new boSchedule_hdr();

 

And then calling its methods like this:

boSchedule_Hdr.FillByPrimaryKey(tiSchedHdr_id);

The error message did not give a true indication of what the actual problem was.


Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Glad you got it figured out....confessional debugging at its best!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search