The record cannot be deleted or changed because table

G

Guest

Probably an ado.net issue.

I have two tables in Access obligor and Collateral, and collateral has
foreign key reference to obligor.

I created a winform to edit obligor. i tried to modify a none primary key
column and got the following error.

this.obligorBindingSource.EndEdit();
this.obligorTableAdapter.Update(this.ldgDataSet.Obligor);

the error shouldn't occur since no PK is modified?


System.Data.OleDb.OleDbException was unhandled
Message="The record cannot be deleted or changed because table
'Collateral' includes related records."
Source="Microsoft JET Database Engine"
ErrorCode=-2147467259
StackTrace:
at
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at
System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable
dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
at
LGD.ldgDataSetTableAdapters.ObligorTableAdapter.Update(ObligorDataTable
dataTable) in C:\Working\crdweb\LGD\ldgDataSet.Designer.cs:line 16984
at LGD.Obligor.btnSave_Click(Object sender, EventArgs e) in
C:\Working\crdweb\LGD\Obligor.cs:line 37
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.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(Form mainForm)
at LGD.Program.Main() in C:\Working\crdweb\LGD\Program.cs:line 17
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()
 
R

RobinS

I already responded to this in the adonet newsgroup. Please don't
multi-post. If you want to ask the same question in multiple groups, put
all of them in the address list at once. That way, if someone in one group
answers the question, others know it, and can spend their time helping
someone else.

Robin S.
--------------------------------
nkw said:
Probably an ado.net issue.

I have two tables in Access obligor and Collateral, and collateral has
foreign key reference to obligor.

I created a winform to edit obligor. i tried to modify a none primary key
column and got the following error.

this.obligorBindingSource.EndEdit();
this.obligorTableAdapter.Update(this.ldgDataSet.Obligor);

the error shouldn't occur since no PK is modified?


System.Data.OleDb.OleDbException was unhandled
Message="The record cannot be deleted or changed because table
'Collateral' includes related records."
Source="Microsoft JET Database Engine"
ErrorCode=-2147467259
StackTrace:
at
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at
System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable
dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
at
LGD.ldgDataSetTableAdapters.ObligorTableAdapter.Update(ObligorDataTable
dataTable) in C:\Working\crdweb\LGD\ldgDataSet.Designer.cs:line 16984
at LGD.Obligor.btnSave_Click(Object sender, EventArgs e) in
C:\Working\crdweb\LGD\Obligor.cs:line 37
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.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(Form mainForm)
at LGD.Program.Main() in C:\Working\crdweb\LGD\Program.cs:line 17
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()
 
G

Guest

sorry, i will search the all address posting method.

RobinS said:
I already responded to this in the adonet newsgroup. Please don't
multi-post. If you want to ask the same question in multiple groups, put
all of them in the address list at once. That way, if someone in one group
answers the question, others know it, and can spend their time helping
someone else.

Robin S.
--------------------------------
nkw said:
Probably an ado.net issue.

I have two tables in Access obligor and Collateral, and collateral has
foreign key reference to obligor.

I created a winform to edit obligor. i tried to modify a none primary key
column and got the following error.

this.obligorBindingSource.EndEdit();
this.obligorTableAdapter.Update(this.ldgDataSet.Obligor);

the error shouldn't occur since no PK is modified?


System.Data.OleDb.OleDbException was unhandled
Message="The record cannot be deleted or changed because table
'Collateral' includes related records."
Source="Microsoft JET Database Engine"
ErrorCode=-2147467259
StackTrace:
at
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at
System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable
dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
at
LGD.ldgDataSetTableAdapters.ObligorTableAdapter.Update(ObligorDataTable
dataTable) in C:\Working\crdweb\LGD\ldgDataSet.Designer.cs:line 16984
at LGD.Obligor.btnSave_Click(Object sender, EventArgs e) in
C:\Working\crdweb\LGD\Obligor.cs:line 37
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.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(Form mainForm)
at LGD.Program.Main() in C:\Working\crdweb\LGD\Program.cs:line 17
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()
 
O

Otis Mukinfus

Probably an ado.net issue.

I have two tables in Access obligor and Collateral, and collateral has
foreign key reference to obligor.

I created a winform to edit obligor. i tried to modify a none primary key
column and got the following error.

this.obligorBindingSource.EndEdit();
this.obligorTableAdapter.Update(this.ldgDataSet.Obligor);

the error shouldn't occur since no PK is modified?


System.Data.OleDb.OleDbException was unhandled
Message="The record cannot be deleted or changed because table
'Collateral' includes related records."
Source="Microsoft JET Database Engine"
ErrorCode=-2147467259
StackTrace:
at
System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at
System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs
rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows,
DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable
dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
at
LGD.ldgDataSetTableAdapters.ObligorTableAdapter.Update(ObligorDataTable
dataTable) in C:\Working\crdweb\LGD\ldgDataSet.Designer.cs:line 16984
at LGD.Obligor.btnSave_Click(Object sender, EventArgs e) in
C:\Working\crdweb\LGD\Obligor.cs:line 37
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons
button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.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(Form mainForm)
at LGD.Program.Main() in C:\Working\crdweb\LGD\Program.cs:line 17
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()

I notice you have a habit of posting the same question to multiple news groups.
That is considered bad form and many folks will not answer questions when they
see this behavior from a poster.

Good luck with your project,

Otis Mukinfus

http://www.otismukinfus.com
http://www.arltex.com
http://www.tomchilders.com
http://www.n5ge.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top