Here is my code:
private void UpdateAspireForTransfer()
{
try
{
BusinessLayer.TransactionBegin("Aspire", IsolationLevel.ReadCommitted);
// Retrieve the next Batch ID
String mBatchID = GetNextBatchID();
AssignBatchID(mBatchID);
CreateCommissions(mBatchID);
BusinessLayer.TransactionCommit("Aspire");
UpdateDynamicsForTransfer(mBatchID);
}
catch
{
BusinessLayer.TransactionRollback("Aspire");
throw;
}
}For some reason, yet unknown to me, the TransactionRollBack gets called and generates an error:
A transaction with the key [DEF_TRANS_KEY] has not been started.
and this stack trace:
at MicroFour.StrataFrame.Data.DbDataSourceItem.TransactionEnd(String TransactionKey, Boolean IsCommit)
at MicroFour.StrataFrame.Data.DbDataSourceItem.TransactionRollback(String TransactionKey)
at MicroFour.StrataFrame.Business.BusinessLayer.TransactionRollback(String DataSourceKey)
at Aspire.Accounting.Invoicing.UpdateAspireForTransfer()
at Aspire.Accounting.Invoicing.TransferTSB_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)
So, what am I doing wrong?
Thanks, for straightening me out,
Bill