J
John
Hi
I have a very simple db app that was created by dragging a couple of fields
onto a windows form. No additional code was added. The problem is that app
gives a concurrency error while deleting a record even though no other user
has access to the app.
Steps to create problem
1. Create an access table Clients with only two fields; ID Auto number and
Company: Text(50).
2. Make a connection to the access db in vs2008 and add the data source to
the connection.
3. From data source, drag the fields ID and Company onto a windows form.
This will create the binding source, binding navigator etc.
4. Click on new (+) icon on toolbar to create a new record.
5. Type XYZ in Company text field and click on Save (disk) icon on toolbar
to save the record.
6. Click on Delete (x) icon to delete the record and then Save icon on
toolbar to save the record deletion.
At this point the error is generated with the stack trace given at the end
below.
What is the problem and how can I fix it?
Thanks
Regards
System.Data.DBConcurrencyException was unhandled
Message="Concurrency violation: the DeleteCommand affected 0 of the expected
1 records."
RowCount=1
Source="Test"
StackTrace:
at Test.DataDataSetTableAdapters.TableAdapterManager.UpdateAll(DataDataSet
dataSet) in C:\Test\DataDataSet.Designer.vb:line 1171 at
Test.Form1.ClientsBindingNavigatorSaveItem_Click(Object sender, EventArgs e)
in C:\Test\Form1.vb:line 6 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.DebuggableCallback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData) at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context) at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context) at
System.Windows.Forms.Application.Run(ApplicationContext context) at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[]
commandLine) at Test.My.MyApplication.Main(String[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at
System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at
System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args) at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at
System.Threading.ThreadHelper.ThreadStart_Context(Object state) at
System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state) at
System.Threading.ThreadHelper.ThreadStart()
InnerException:
I have a very simple db app that was created by dragging a couple of fields
onto a windows form. No additional code was added. The problem is that app
gives a concurrency error while deleting a record even though no other user
has access to the app.
Steps to create problem
1. Create an access table Clients with only two fields; ID Auto number and
Company: Text(50).
2. Make a connection to the access db in vs2008 and add the data source to
the connection.
3. From data source, drag the fields ID and Company onto a windows form.
This will create the binding source, binding navigator etc.
4. Click on new (+) icon on toolbar to create a new record.
5. Type XYZ in Company text field and click on Save (disk) icon on toolbar
to save the record.
6. Click on Delete (x) icon to delete the record and then Save icon on
toolbar to save the record deletion.
At this point the error is generated with the stack trace given at the end
below.
What is the problem and how can I fix it?
Thanks
Regards
System.Data.DBConcurrencyException was unhandled
Message="Concurrency violation: the DeleteCommand affected 0 of the expected
1 records."
RowCount=1
Source="Test"
StackTrace:
at Test.DataDataSetTableAdapters.TableAdapterManager.UpdateAll(DataDataSet
dataSet) in C:\Test\DataDataSet.Designer.vb:line 1171 at
Test.Form1.ClientsBindingNavigatorSaveItem_Click(Object sender, EventArgs e)
in C:\Test\Form1.vb:line 6 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.DebuggableCallback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam) at
System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at
System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData) at
System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context) at
System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason,
ApplicationContext context) at
System.Windows.Forms.Application.Run(ApplicationContext context) at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at
Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[]
commandLine) at Test.My.MyApplication.Main(String[] Args) in
17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at
System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at
System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
assemblySecurity, String[] args) at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at
System.Threading.ThreadHelper.ThreadStart_Context(Object state) at
System.Threading.ExecutionContext.Run(ExecutionContext executionContext,
ContextCallback callback, Object state) at
System.Threading.ThreadHelper.ThreadStart()
InnerException: