StrataFrame Forum

Problems calling FillByPrimaryKey method of a BO

http://forum.strataframe.net/Topic27775.aspx

By Marcia G Akins - 7/29/2010

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

By Marcia G Akins - 7/29/2010

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.

By Greg McGuffey - 7/29/2010

Glad you got it figured out....confessional debugging at its best!