Click here to Skip to main content
15,893,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI
I Have a problem to save transaction in two table header -details
the next codigo error is the following:


Thanks for the help me




System.Data.Entity.Core.EntityException was unhandled
HResult=-2146233087
Message=The underlying provider failed on Commit.
Source=EntityFramework
StackTrace:
en System.Data.Entity.Core.EntityClient.EntityTransaction.Commit()
en System.Data.Entity.DbContextTransaction.Commit()
en Cotizacion_Clientes.Cotizaciones.button2_Click(Object sender, EventArgs e) en E:\PROYECTOS_VS2015\Cotizacion_Clientes\Cotizacion_Clientes\Cotizaciones.cs:línea 64
en System.Windows.Forms.Control.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
en System.Windows.Forms.Control.WndProc(Message& m)
en System.Windows.Forms.ButtonBase.WndProc(Message& m)
en System.Windows.Forms.Button.WndProc(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
en System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
en System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
en System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.RunDialog(Form form)
en System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
en System.Windows.Forms.Form.ShowDialog()
en Cotizacion_Clientes.Seleccione_Empresa.button1_Click(Object sender, EventArgs e) en E:\PROYECTOS_VS2015\Cotizacion_Clientes\Cotizacion_Clientes\Seleccione_Empresa.cs:línea 46
en System.Windows.Forms.Control.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnClick(EventArgs e)
en System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
en System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
en System.Windows.Forms.Control.WndProc(Message& m)
en System.Windows.Forms.ButtonBase.WndProc(Message& m)
en System.Windows.Forms.Button.WndProc(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
en System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
en System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
en System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
en System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
en System.Windows.Forms.Application.Run(Form mainForm)
en Cotizacion_Clientes.Program.Main() en E:\PROYECTOS_VS2015\Cotizacion_Clientes\Cotizacion_Clientes\Program.cs:línea 19
en System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
en System.Threading.ThreadHelper.ThreadStart_Context(Object state)
en System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
en System.Threading.ThreadHelper.ThreadStart()
InnerException:
HResult=-2147467261
Message=El valor no puede ser nulo.

Nombre del parámetro: connection
ParamName=connection
Source=EntityFramework
StackTrace:
en System.Data.Entity.Utilities.Check.NotNull[T](T value, String parameterName)
en System.Data.Entity.Infrastructure.Interception.DbTransactionInterceptionContext.WithConnection(DbConnection connection)
en System.Data.Entity.Infrastructure.Interception.DbTransactionDispatcher.Commit(DbTransaction transaction, DbInterceptionContext interceptionContext)
en System.Data.Entity.Core.EntityClient.EntityTransaction.Commit()
InnerException:

What I have tried:

save Transaction
in the table was saved the transaction but this error is presented.
Posted
Updated 18-May-20 4:19am

I think the InnerException message make it pretty obvious.
The value cannot be null

The table you're dealing with has a column that is specified to NOT accept null values, and you supplied one, or stated the other way, you failed to supply a value for a column that expected a value.
 
Share this answer
 
According to this issue on GitHub[^], you're trying to commit the transaction after the SaveChanges call has failed:
Commit yields EntityException with ArgumentNullException if SaveChanges failed · Issue #667 · dotnet/ef6 · GitHub[^]
 
Share this answer
 
NOT because
the transaccion was saved but show this error.
 
Share this answer
 
Comments
Richard Deeming 18-May-20 10:14am    
If you want to reply to a solution, click the "Have a Question or Comment?" button under the solution and post a comment.

Do not post your comment as a new "solution".

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900