468,103 Members | 1,222 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,103 developers. It's quick & easy.

TableAdapter.update not working for a relationed table

jas16183
Hi Guys,
need some help here,
Im working on a project in vb.net, the problem im facing is that my tableadapter.update(dataset.datatable) is not functioning,
the datatable has a relation with another table, the relationship is on to many.
in the dataset designer I configured it to Relation only,
the database is in mdf format, I can update my records in the access file, and can do it also in the server explorer, but not when from my form, instead i get an oledb exception.
here is the exception:
System.Data.OleDb.OleDbException was unhandled
ErrorCode=-2147467259
Message="The record cannot be deleted or changed because table 'tblVacations' includes related records."
Source="Microsoft JET Database Engine"
StackTrace:
at System.Data.Common.DbDataAdapter.UpdatedRowStatusE rrors(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.UpdateFromDataTab le(DataTable dataTable, DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
at HRS.HRS2007DataSetTableAdapters.tblStaffTableAdapt er.Update(tblStaffDataTable dataTable) in C:\Users\Jassim\Documents\Visual Studio 2005\Projects\HRS\HRS\HRS2007DataSet.Designer.vb:l ine 4406
at HRS.frmStaff.btnSave_Click(Object sender, EventArgs e) in C:\Users\Jassim\Documents\Visual Studio 2005\Projects\HRS\HRS\frmStaff.vb:line 35
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventAr gs 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.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationCo ntext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsF ormsApplicationBase.Run(String[] commandLine)
at HRS.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.Run UsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


can anyone help with this matter
Thanks
Dec 26 '07 #1
0 2810

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by RobZ via DotNetMonster.com | last post: by
2 posts views Thread by GaryDean | last post: by
3 posts views Thread by =?Utf-8?B?UmljaCBIdXRjaGlucw==?= | last post: by
1 post views Thread by Sreekanth | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.