StrataFrame Forum

Concurrency error occuring when UpdateConcurrencyType is Off

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

By Marcia G Akins - 9/1/2008

I am getting this error when I try to save data to my SQL Server database using a stored procedure. UpdateConcurrencyType is Off. So why am I getting this error and how can I stop it from happening?

BTW, I have stepped through the code and I can see that the problem is occurring on this line:

Dim lnReturn As Integer = Command.ExecuteNonQuery()

in the InternalExecuteNonQuery method. The value of lnReturn is -1. However, SQL Profiler shows that the command executed successfully and the data gets updated. So what is going on here?

BusinessLayerException
  An error occurred while saving an the data to the server.
DataLayerSavingException
  Possible concurrency issue encountered.
DBConcurrencyException
  Possible concurrency issue encountered.

Source     : MicroFour StrataFrame Business

Stack Trace:
   at MicroFour.StrataFrame.Data.DataLayer.SaveByForm(DataTable TableToSave, Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.Business.BusinessLayer.SaveByForm(Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save(Boolean Transactional, String TransactionKey)
   at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save()
   at MicroFour.StrataFrame.UI.Windows.Forms.MaintenanceFormToolStrip.cmdSave_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)

By Marcia G Akins - 9/1/2008

Never mind - the problem was caused by this line at the top of the stored procedure:

SET NOCOUNT ON

It would be nice if these nuances were documented somewhere.

By Dustin Taylor - 9/2/2008

Glad you got it working BigGrin

We don't specifically address creating custom (non DDT created) stored procedures in the help, but I agree the SET NOCOUNT ON nuance would be helpfull to include within the documentation. I'll add a note to the pertinent topics for the next build.

But regardless, the forum is the best place to look for these tyeps of nuances and tips for the framework. The CHM documentation simply can't compete with the depth of topics and tricks contributed by the users and SF staff.

By Marcia G Akins - 9/2/2008

Hi Dustin.

>> We don't specifically address creating custom (non DDT created) stored procedures in the help, but I agree the SET NOCOUNT ON nuance would be helpfull to include within the documentation. I'll add a note to the pertinent topics for the next build. <<

Thanks! I would hate to have anyone else have to go through what I went throguh yesterday trying to figure this out Sad

>> But regardless, the forum is the best place to look for these tyeps of nuances and tips for the framework. The CHM documentation simply can't compete with the depth of topics and tricks contributed by the users and SF staff.  <<

Well, as you can see, I have been posting like mad Smile Even with the sparse documentation, the SET NOCOUNT ON was the worst thing I have run into while trying to get my head around it.