Sambapos v5.5.4 crashes, when creating a new user

Good day, I’m facing serious issues here and my client is lunching his lounge in 2 days time. but im having crash issues each time i try to add a new user account. the software keeping crashing, i entered the required field, yet it keep occurring. Please can someone help me??

after entering the mandatory fields here is what shows up.

[General Info]

Application: SambaPOS
Version: 5.5.4
Region: en
DB: SQ
Machine: ADMIN
User: ADMIN
Date: 9/26/2022
Time: 8:22 PM

User Explanation:

ADMIN said “”

[Exception Info 1]

Top-level Exception
Type: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
Stack Trace: at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)

Inner Exception 1
Type: System.Data.Entity.Infrastructure.DbUpdateException
Message: An error occurred while saving entities that do not expose foreign key properties for their relationships. The EntityEntries property will return null because a single entity cannot be identified as the source of the exception. Handling of exceptions while saving can be made easier by exposing foreign key properties in your entity types. See the InnerException for details.
Source: EntityFramework
Stack Trace: at System.Data.Entity.Internal.InternalContext.SaveChanges()
at System.Data.Entity.Internal.LazyInternalContext.SaveChanges()
at System.Data.Entity.DbContext.SaveChanges()
at Samba.Infrastructure.Data.SqlData.EFWorkspace.CommitChanges()
at Samba.Presentation.Common.ModelBase.EntityCollectionViewModelBase2.<.ctor>b__0_3(EventParameters1 x)
at Microsoft.Practices.Prism.Events.EventSubscription1.InvokeAction(Action1 action, TPayload argument)
at Microsoft.Practices.Prism.Events.EventSubscription1.<>c__DisplayClass2.<GetExecutionStrategy>b__0(Object[] arguments) at Microsoft.Practices.Prism.Events.EventBase.InternalPublish(Object[] arguments) at Microsoft.Practices.Prism.Events.CompositePresentationEvent1.Publish(TPayload payload)
at Samba.Presentation.Services.Common.ExtensionMethods.Publish[TEventsubject](TEventsubject eventArgs, String eventTopic, Action expectedAction)

Inner Exception 2
Type: System.Data.Entity.Core.UpdateException
Message: An error occurred while updating the entries. See the inner exception for details.
Source: EntityFramework
Stack Trace: at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.<>c.b__21_0(UpdateTranslator ut)
at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update[T](T noChangesResult, Func2 updateFunction) at System.Data.Entity.Core.EntityClient.Internal.EntityAdapter.Update() at System.Data.Entity.Core.Objects.ObjectContext.<SaveChangesToStore>b__153_0() at System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction[T](Func1 func, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction, Boolean releaseConnectionOnSuccess)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(SaveOptions options, IDbExecutionStrategy executionStrategy, Boolean startLocalTransaction)
at System.Data.Entity.Core.Objects.ObjectContext.<>c__DisplayClass148_0.b__0()
at System.Data.Entity.Infrastructure.DbExecutionStrategy.Execute[TResult](Func`1 operation)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(SaveOptions options, Boolean executeInExistingTransaction)
at System.Data.Entity.Core.Objects.ObjectContext.SaveChanges(SaveOptions options)
at System.Data.Entity.Internal.InternalContext.SaveChanges()

Inner Exception 3
Type: System.Data.SqlClient.SqlException
Message: Cannot insert the value NULL into column ‘SevenShiftsEmployeeId’, table ‘sambaPOS.dbo.Users’; column does not allow nulls. INSERT fails.
The statement has been terminated.
Source: .Net SqlClient Data Provider
Stack Trace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
at System.Data.SqlClient.SqlDataReader.get_MetaData()
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<>c.<Reader>b__6_0(DbCommand t, DbCommandInterceptionContext1 c)
at System.Data.Entity.Infrastructure.Interception.InternalDispatcher1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func3 operation, TInterceptionContext interceptionContext, Action3 executing, Action3 executed)
at System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(DbCommand command, DbCommandInterceptionContext interceptionContext)
at System.Data.Entity.Internal.InterceptableDbCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(Dictionary2 identifierValues, List1 generatedValues)
at System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update()


[Assembly Info]

mscorlib, Version=4.0.0.0
System, Version=4.0.0.0
Samba.Services, Version=5.5.8293.28453
Samba.Domain, Version=5.5.8293.28452
Samba.Infrastructure.Data, Version=5.5.8293.28451
System.ComponentModel.Composition, Version=4.0.0.0
Samba.Presentation.Services, Version=5.5.8293.28455
System.Core, Version=4.0.0.0
PresentationCore, Version=4.0.0.0
WindowsBase, Version=4.0.0.0
PresentationFramework, Version=4.0.0.0
DevExpress.Xpf.LayoutControl.v17.2, Version=17.2.13.0
System.Xml, Version=4.0.0.0
DevExpress.Xpf.Grid.v17.2, Version=17.2.13.0
DevExpress.Xpf.Grid.v17.2.Core, Version=17.2.13.0
System.Xaml, Version=4.0.0.0
Samba.Infrastructure, Version=5.5.8293.28449
Microsoft.Practices.Prism, Version=4.0.0.0
System.Runtime.Serialization, Version=4.0.0.0
Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0
DevExpress.Xpf.Core.v17.2, Version=17.2.13.0
System.Windows.Forms, Version=4.0.0.0
System.Drawing, Version=4.0.0.0
Samba.Persistance, Version=5.5.8293.28452
Stateless, Version=1.0.0.0
PropertyTools, Version=2012.4.14.1
Samba.Localization, Version=5.3.8293.28450
ReachFramework, Version=4.0.0.0
EntityFramework, Version=6.0.0.0
FluentValidation, Version=3.4.0.0
NCalc, Version=1.3.8.0
Microsoft.CSharp, Version=4.0.0.0
Omu.ValueInjecter, Version=2.3.0.0
Microsoft.Practices.ServiceLocation, Version=1.0.0.0
DevExpress.Data.v17.2, Version=17.2.13.0
WindowsInput, Version=1.0.4.0


[System Info]

Operating System
-Microsoft Windows 10 Enterprise
–CodeSet = 1252
–CSDVersion =
–CurrentTimeZone = 60
–FreePhysicalMemory = 2013208
–OSArchitecture = 64-bit
–OSLanguage = 1033
–ServicePackMajorVersion = 0
–ServicePackMinorVersion = 0
–Version = 10.0.10240

Machine
-ADMIN
–Manufacturer = LENOVO
–Model = 10RX0035UM
–TotalPhysicalMemory = 4135632896
–UserName = ADMIN\ADMIN


######################### E N D #########################

Please email support@sambapos.com

Of course email support but if you are in a hurry and can’t wait then you might try to go back to 5.5.2 if you can and have a backup. The user admin is significantly different there - it has a pre-filled 0 for the ‘7Shifts Employee Id’ whereas apparently 5.5.4 does have an Employee Id field instead. The exception here suggests that Samba tries to add a NULL value to the ‘SevenShiftsEmployeeId’ field in the database and fails. The definition of this database field does not allow NULLs.

You can delete the sevenshiftsuser column from the users table. But do not do this if you are unsure how.

Ok. Thanks guys I will try to delete the sevenshift table but if It couldn’t resolve it then I have to fall back to the older version.

NOT the table, the column in the user table.
image

I’m not responsible for mess ups and ALWAYS backup DB first but here is a script you can run to remove column from the users table.


IF EXISTS(SELECT 1 FROM sys.columns
WHERE Name = N’SevenShiftsEmployeeId’
AND Object_ID = Object_ID(N’Users’))
BEGIN
alter table Users
drop column SevenShiftsEmployeeId
END
GO


1 Like

Pls jese can you send me sambapos v5.3.6 .exe

Can you please download and reinstall 5.5.4 from our downloads section.

Has this been fixed in the 5.5.4 download on the site?

Thanks for the clue, though I ran the script but there was error on the 2 line which is N’ but the script is trying to delete Sevenshift table which I did manually and it worked. :muscle::smile:…thanks everyone for your contributions.

Sorry I typed that up quick and didnt test it. Make sure when you copy it that the single tickets around the table and column name are straight tics not curved.

Latest download and install as of today still has same issue. Deleting column in Users table does solve the issue.

Hey, how can handle this, am using LocalDB and not SQL

Create a task using the script he shared and just execute it using Database Tools

Documents/SambaPOS/Database Tasks

I did that but keep getting incorrect syntax near

IF EXISTS(SELECT 1 FROM sys.columns
WHERE Name = 'SevenShiftsEmployeeId'
AND Object_ID = Object_ID(N'Users'))
BEGIN
ALTER TABLE Users
DROP CONSTRAINT DF_Users_SevenShiftsEmployeeId

ALTER TABLE Users
DROP COLUMN SevenShiftsEmployeeId
END
GO
4 Likes

Thanks gave an error on SevenShiftsEmployeeId not being find as a constraint but it’s works

It was there in my database so I added it in the script. Was rushing out to go meet my client so didn’t have time to create a small piece of logic to check for the constraint before.

1 Like