Error on Delete


Author
Message
Scott
Scott
StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
When deleting the last record in a table I get an indexoutofrange exception.  Any Ideas.
StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
OK, I just went through trying to reproduce your error. I started with 3 records in the business object and called DeleteCurrentRow on all 3 both by only marking them as deleted and by deleting them directly from the server. Never got an IndexOutOfRangeException.



Is your business object's editing state Idle, Editing, or Adding? While you gather me some more info on your scenario, I'm going to go look at the code and see if I can find find anything obvious.
StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Can you attach a screenshot of the red error window you're receiving? It should have the stack trace on it, and that should help.
Scott
Scott
StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
Here is the trace stack,  I am almost sure I messed something up I just don't know what it is.

BusinessLayerException
 An error occurred while trying to delete the specified row.
BusinessLayerException
 An error occurred while refreshing the data from field 'SFCategoryBO.catdesc' to property 'Text' on control 'textbox1.'
BusinessLayerException
 An error occurred while refreshing property 'Text' to control 'textbox1'
IndexOutOfRangeException
 Index 9 is either negative or above rows count.

Source     : MicroFour StrataFrame Business

Stack Trace:
   at System.Data.DataView.GetElement(Int32 index)
   at System.Data.DataView.get_Item(Int32 recordIndex)
   at MicroFour.StrataFrame.Business.BusinessLayer.get_CurrentRow()
   at QuoteBOLib.SFCategoryBO.get_catdesc() in C:\SF\QuoteBOLib\QuoteBOLib\SFCategoryBO.Designer.cs:line 304
   at QuoteBOLib.SFCategoryBO.Field_catdesc_Descriptor.GetValue(Object component) in C:\SF\QuoteBOLib\QuoteBOLib\SFCategoryBO.Designer.cs:line 569
   at System.Windows.Forms.BindToObject.GetValue()
   at System.Windows.Forms.Binding.PushData(Boolean force)
   at System.Windows.Forms.Binding.ReadValue()
   at MicroFour.StrataFrame.Business.BusinessLayer.RefreshValue(Control ControlToRefresh, String PropertyName)
   at MicroFour.StrataFrame.Business.BusinessLayer.RefreshControl(IBusinessBindable ControlToRefresh, Boolean DataPresent)
   at MicroFour.StrataFrame.Business.BusinessLayer.RefreshBoundControls()
   at MicroFour.StrataFrame.Business.BusinessLayer.RaiseEditingStateChanged(EditingStateChangedEventArgs e, Boolean RefreshControls)
   at MicroFour.StrataFrame.Business.BusinessLayer.SetEditingState(BusinessEditingState EditState, Boolean RefreshControls)
   at MicroFour.StrataFrame.Business.BusinessLayer.DeleteByPrimaryKey(Object PrimaryKeyValue)
   at MicroFour.StrataFrame.Business.BusinessLayer.DeleteCurrentRow(Boolean CheckSecurity, Boolean OnlyMarkAsDeleted)
   at MicroFour.StrataFrame.Business.BusinessLayer.DeleteCurrentRow(Boolean OnlyMarkAsDeleted)
   at MicroFour.StrataFrame.UI.Windows.Forms.MaintenanceFormToolStrip.cmdDelete_Click(Object sender, EventArgs e)
   at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
   at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Is the ShowDeletedRows property on the business object True or False?
Scott
Scott
StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
False
StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Oh, I just spotted the stack trace where it said that the Index was 9... I'm going to try to reproduce it here in a second, but right now I've got the help documenation re-building the class library help. I can't debug while it's working, so it will be a couple more minutes.
StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Fixed it... looking through the back logs of our source control, nothing changed... the logic was just a little off under certain conditions, so the index was never reduced to the new last record. Here's the DLL (follow the instructions in the Update Blog to get it installed) and the install will be rebuilt probably tomorrow.
Attachments
MicroFour StrataFrame Business.zip (134 views, 350.00 KB)
Scott
Scott
StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)StrataFrame User (212 reputation)
Group: Forum Members
Posts: 176, Visits: 1.5K
Works great,  Thank You.
StrataFrame Team
S
StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)StrataFrame Developer (4.7K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
No problem, you find it, I fix it Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search