SQL Statement error showing as rowindex out of boundary error in setproperty.

SQL Statement error showing as rowindex out of boundary error in setproperty.

Old forum URL: forums.lhotka.net/forums/t/10911.aspx


bala345 posted on Wednesday, November 23, 2011

I am using CSLA 3.8.3, Doing windows forms programming. 

I my Root object (a BB) ,  I have a BLB as Child.  BLB contains List of ChildRecord.

In the ChildRecord  I have a SlNo Field  --  It stores the record number . ( I use  BLBbindingsource.postion +1 to set the SlNo field)

When I fetch a saved  Root from Database and delete one childRecord in BLB,  In the PostionChangedEvent Or in the Roots's ChildChagedEvent,    I have to loop through all the records and change the SlNo for all the Childrecords.  It works until I hit save.  But When I try to save it,  the item deleted gets deleted. But No other changes I made after the deletion  get saved.  

Is there a way to set this right?

 

 

 

 

 

 

 

bala345 replied on Saturday, November 26, 2011

This behavior was found to be because of a error in SQL update Stored Procedure 

Which was like 

"

Create Proc   MyDetail_Update

declare @Param1 int , @param2 varchar(10)  ....

as

Begin

 Update  MyDetail

Set  Field1  =  @param1,  Field2 = @param2 ....

where  KeyField = @paramx and  SlNo = @SlNo 

Return

end 

"

The problem is,  SlNo is made as a PrimaryKey which was not passed the old SlNo value which was modified.   Since the error's never throw an sql exception but some rowindex out of range kind of exceptions in setproperty  - I thought that it is coming somewhere from the code which I could not find any fault with. 

 

 

Copyright (c) Marimer LLC