StrataFrame Forum

Calling Add on a Business Object

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

By Bill Cunnien - 10/24/2008

When I call the add method of the business object, I am not getting a new record. 

The CurrentRow for table '[dbo].[ProdWOEquipment]' could not be evaluated because the CurrentRowIndex is out of range.  Business object record count: 0.  CurrentRowIndex: -1.

Here is the call stack:


> MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.get_CurrentRow() Line 1790 Basic
  AspireModel.dll!Aspire.Model.ProductionWorkOrderEquipmentBO.createby.set(int value = 1) Line 419 + 0x8 bytes C#
  AspireModel.dll!Aspire.Model.ProductionWorkOrderEquipmentBO.ProductionWorkOrderEquipmentBO_SetDefaultValues() Line 77 + 0x1c bytes C#
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.raise_SetDefaultValues() Line 1662 + 0xe bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.OnSetDefaultValues() Line 1673 + 0xa bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.NewRow() Line 6047 + 0xb bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.Add(Boolean CheckSecurity = True) Line 7283 + 0xa bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.Add() Line 7254 + 0xf bytes Basic

The odd things is that I use the same kind of code elsewhere and it runs beautifully.  There is something different about this BO's class.  I am just not seeing it.  I'll keep looking, but if anyone has some tips or tricks to share, I'd appreciate it.

Bill

By Greg McGuffey - 10/24/2008

Bill,



It's hard to tell what might going on with just the call stack. Try setting a break point in SetDefaultValues and step through until you get the error. Set a watch on the current row index. The light bulbs gone off for me many times by just doing that.
By Bill Cunnien - 10/24/2008

Thanks, Greg.  As I walk the code it always bombs as it is setting the first default value.  The current row index evaluates as -1.  If I comment out the default values, the Add() command still ends up bombing on the get_CurrentRow() method of the BusinessLayer.  For some reason the BO is not making a new row in the data table.  I will keep testing...maybe a light bulb will go off for me, too.  Hehe
By Bill Cunnien - 10/24/2008

Does this mean anything?

_COMPlusExceptionCode = -532459699

By Edhy Rijo - 10/24/2008

Hi Bill,

Is this a child BO? I had a similar situation before where the child BO was not creating the new row, don't remember what I did Hehe, but can look at my project to refresh my memory if needed, so let me know if this is a child BO.

By Edhy Rijo - 10/24/2008

Bill Cunnien (10/24/2008)
Does this mean anything?

_COMPlusExceptionCode = -532459699

This is form google:

_COMPlusExceptionCode = -532459699

this error usally occurs when sql connection timeout or if the sql server is down.

i got the same error when i tried to access the webservice which is located in another webserver. (That webserver was down at that time).

Maybe you need to close VS and test again.

By Bill Cunnien - 10/24/2008

Is this a child BO? . . . so let me know if this is a child BO.

Yes. 

The DB is accessible.  I have closed and restarted VS several times.  Other similar classes and BOs work just fine (all other applications are hitting the DB without issues).  I'll take a closer look at the parent-child relationship.

Thanks!
Bill

By Edhy Rijo - 10/24/2008

Ok, I found my notes Tongue

I am calling a child form from a listview, in the childform.Load() I did the following:

' Force the BO assignment here to fix a problem of the BO.Add() not working properly.

Me.lstItemService.BusinessObject = Me.bizSC_AppliancesItems1

I don't know why was this happening and it was very difficult to reproduce in the sample application, so since this worked, I just leave it and moved on to new issues.Hehe