更新不会更改表上的字段值

时间:2013-12-19 18:43:44

标签: .net vb.net adapter

我正在使用.net开发Epicor的自定义。我正在尝试更新一个表,但是,我不知道为什么它不起作用。在关闭应用程序后,字段保持包含相同的值。有什么我想念的吗?提前谢谢!

Dim adapterLaborDtlSearch As LaborDtlSearchAdapter = New LaborDtlSearchAdapter(HHWorkQueueForm)
adapterLaborDtlSearch.BOConnect()
LaborDtlDV = CType(oTrans.EpiDataViews("LaborDtl"), EpiDataView)
Dim laborHedSeq As Integer = LaborDtlDV.dataView(LaborDtlDV.Row)("laborHedSeq")
Dim laborDtlSeq As Integer = LaborDtlDV.dataView(LaborDtlDV.Row)("laborDtlSeq")
Dim laborDtlSchDataSet As Data.DataSet = adapterLaborDtlSearch.GetData(laborHedSeq, laborDtlSeq)
laborDtlSchDataSet.Tables("LaborDtl").Rows(0).BeginEdit
laborDtlSchDataSet.Tables("LaborDtl").Rows(0).Item("LaborQty") = nedShiftQty.value
laborDtlSchDataSet.Tables("LaborDtl").Rows(0).EndEdit
laborDtlSchDataSet.Tables("LaborDtl").AcceptChanges
adapterLaborDtlSearch.Update()

这是更新方法的堆栈跟踪。

Exception caught in: Epicor.Mfg.BO.LaborDtlSearch

Error Detail
============
Message: This function is not allowed.
Type: Error
Program: bo/LaborDtlSearch/LaborDtlSearch.p
Method: laborDtlBeforeUpdate
Table: laborDtl
Row: 
Field: 

Stack Trace
===========
   at Epicor.Mfg.Proxy.LaborDtlSearchImpl.Update(LaborDtlSearchDataSet ds)
   at Epicor.Mfg.UI.Adapters.LaborDtlSearchAdapter.Update()
   at Script.updateTablesData()

Inner Exception
===============
ERROR condition: The Server application has returned an error. (7243)  (7211) 

Inner Stack Trace
=================
   at Progress.Open4GL.DynamicAPI.Session.runProcedure(String requestID, String procedureName, ParameterSet parms, Boolean persistent, Boolean internal_Renamed, Int64 procId, MetaSchema localSchema, Int32 stateModel)
   at Progress.Open4GL.DynamicAPI.Session.runStatelessProcedure(String requestID, String fullProcedureName, ParameterSet inparams, Object procId, MetaSchema localSchema, Int32 stateModel)
   at Progress.Open4GL.DynamicAPI.PersistentProc.runTheProcedure(String requestID, String procedureName, ParameterSet parms, MetaSchema schema)
   at Progress.Open4GL.DynamicAPI.PersistentProc.runProcedure(String procedureName, ParameterSet parms, MetaSchema schema)
   at Epicor.Mfg.Core.CallContext.CallContextPersistentProc.runProcedure(String procedureName, ParameterSet parameters, MetaSchema metaSchema)
   at Epicor.Mfg.Core.CallContext.ProxyHelper.CallMethod(String methodName, ParameterSet parameters, MetaSchema metaSchema, BLConnectionPool connPool, Session connection, PersistentProc persistProc, CallContextDataSet callContextDataSet)
   at Epicor.Mfg.Proxy.LaborDtlSearchImpl.Update(LaborDtlSearchDataSet ds)

1 个答案:

答案 0 :(得分:0)

AcceptChanges来电后将通话移至adapterLaborDtlSearch.Update()

  

调用AcceptChanges时,任何仍处于编辑模式的DataRow对象都会成功结束其编辑。 DataRowState也会更改:所有已添加和已修改的行变为未更改,并删除已删除的行。

     

在尝试使用DbDataAdapter.Update方法更新DataSet后,通常会在DataTable上调用AcceptChanges方法。

http://msdn.microsoft.com/en-us/library/system.data.datatable.acceptchanges%28v=vs.110%29.aspx