StrataFrame Forum

Whats the easiest way to delete all records in a business object and update the server

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

By Mike Thomas - 9/26/2008

Whats the easiest way to delete all records in a business object and update the server? Also, how do you supress the "Are you sure message?"?.  the following does not seem to be working....

Me.CasedetailBO.Clear()

Me.CasedetailBO.FillByCaseNum(lcSRNum)

Me.CasedetailBO.MoveFirst()

Do

Me.CasedetailBO.DeleteCurrentRow()

Loop While CasedetailBO.MoveNext

Me.CasedetailBO.Save()

By Trent L. Taylor - 9/26/2008

Whats the easiest way to delete all records in a business object and update the server?

Just enumerate the BO and call the DeleteCurrentRow method on the BO.  You can also create an array of the PKs if you have the need and then delete each of the records individually by enumerating the array of the PKs that need to be deleted.  Just FYI, Clear() does not delete the BO.  It resets the BO without a fill and you will lose any changes that needed to be committed.

Also, how do you supress the "Are you sure message?"?.

Just set the AutoShowDeleteConfirmation property on the form to False.