Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
System.Data.RowNotInTableException
Message
From
26/10/2009 08:23:44
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01431150
Message ID:
01431466
Views:
30
Hi Eric,

>Ok, good news. I know how it's happening. I'm still not sure why.
>
>Here's what's going on. In my code, the main business object is MemberPay.
>
>I have a call to show all the dues that have already been paid, via an EntityList. This is where this page varies from prior pages. In prior pages, I used a *different* object to get this info, and I used a DataSet rather than an EntityList. In this page, I do
>
mmBindingList<MemberPayEntity>) oPayments = oDuesPayment.getDuesPaymentHistory(iCustomerId);
> [which within it calls a MemberPay.getEntityList()]
>
>Then, a little further down, I have a call to create a blank entity, in case they want to add a new dues.
>
  oDuesPayment = (MemberPay)this.RegisterBizObj(new MemberPay());
>  oDuesPayment.NewEntity();
>
>This seems to be where the crux of the problem is. Making the call to NewEntity() disconnected my EntityList oPayments from the entity's DataTable. If I move the call to get oPayments after oDuesPayment is instantiated, the business object bound to the controls of the form is always the first entity in oPayments regardless if I meant to add a new one or edit a different one.
>
>It's like a catch-22, but I think if I could make one call to get all my payments related to this customer, then make a certain one in that list bound to my controls, I'd be all set.
>
>Thanks,
>Eric

Based on your code it looks like you are reinstantiating the MemberPay business object. You might want to consider creating your biz obj reference outside of the methods and instantiating it only once within the page class. Then you can use it without re-instantiating it.

Keep in mind also that if you call a method on the business object to get data it will be stored in the business objects related properties for DataSet, Entity, and EntityList. Then if you make another call to the same business object to get data again, it will replace the data stored in those properties.

In the case you are showing here I would put my reference to the business object outside the method and then instantiate it with the register call within my page load. Then when you make your call to create a new entity, reuse the same business object to create a new entity within the existing data retreived. Does that make sense? If not, feel free to post more of your code and I will try to help out.
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform