Database Tools Export error : Sequence Contains No Elements

Hi Guys,

Recently i bought the Database tools module.
However, i can’t export my settings. There’s always error notification “Sequence contains no elements”

I found out that the error always showed up when i check “Departments” on the export item selection screen. If i didn’t check “Departments” the export runs fine.

Any ideas what caused this and any help to fix this would be appreciated


Additional info from log (i Hope i copy the right one)

[General Info]

Application: SambaPOS
Version: 4.1.61
Region: en
Machine: KELVIN
User: Kelvin
Date: 9/27/2014
Time: 3:21 AM

User Explanation:

Kelvin said “”

[Exception Info 1]

Top-level Exception
Type: System.Data.DataException
Message: An exception occurred while initializing the database. See the InnerException for details.
Source: EntityFramework
Stack Trace: at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
at System.Data.Entity.Internal.LazyInternalContext.b__4(InternalContext c)
at System.Data.Entity.Internal.RetryAction1.PerformAction(TInput input) at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action1 action)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet1.Initialize() at System.Data.Entity.Internal.Linq.InternalSet1.get_InternalContext()
at System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get_Provider() at System.Linq.Queryable.Count[TSource](IQueryable1 source)
at Samba.Infrastructure.Data.SqlData.EFWorkspace.CountT
at Samba.Presentation.Services.Common.DataGeneration.DataCreationService.ShouldCreateData()
at Samba.Presentation.Services.Common.DataGeneration.DataCreationService.CreateData()
at Samba.Presentation.Bootstrapper.InitializeShell()

Thanks before guys, any help would be really appreciated.


Check and make sure you do not have a Ticket Type or Menu defined inside a department that does not exist. Also check Warehouse.

No this is not the correct error message. Probably what @Jesse suggested will solve that. If not PM me a zip file that contains log.txt. You can find it under [My Documents]\SambaPOS4

Hi @Jesse & @emre ,

I checked my settings like what @Jesse suggested, but Ticket type, Menu, and Warehouse seems fine.
I will send my log.txt to @emre then.

Thanks a lot!

Did you rename any departments that were default?

Yes i did… :open_mouth:

Ok so there is probably a mapping somewhere still mapped to the OLD name. this can be Rules, Entity Types, etc.

You can scour everything looking for mapping or try deleting the department… logging out… logging in and remake it. then log out again then log back in and try the Database Tools export

The delete method may require you to redo some mapping but most stuff is not mapped to specific department unless you changed that. so you should be good.

Dear Kendash,

I tried to rename the departments back to “restaurant” & delete some entity… Still a no go :frowning:
I will try to check everything again now.


You can not just rename it back… Try the EXACT sequence I just told you… Delete it completely… log out… log back in… recreate it… log out… log back in.

Hi Kendash,

I tried the delete method like you suggested, still didn’t work out :frowning:
I also realize that i can’t import the settings through Database Tools. It says “Sequence Contains more than one matching element”

Its the Departments. I know renaming default settings can cause it to go crazy sometimes. I had it do that with my Customer Entity Type. Did not matter what I did it would do that the only thing that fixed it was starting a new database and copying all my settings over manually. I do not know if thats your issue… but it sounds very familiar.

Dear Kendash,

Thanks a lot for all the input.
I also imported the demo .sdf file for delivery from here Set up basic Database for Take-away/Dine-in/delivery restaurant for $ to my SQL server.
Do you think that caused the problem?


I do not think that would cause the problem but it could be a contributor or indicator. If you are ok with using default department… then just skip exporting departments… it will set everything else up just fine with default department when you import. Just make sure you set your mappings correct before export.

Dear @Jesse,

I’ve got same error message. I’ve tried to delete departments as your advice but it doesn’t work. Can you export from your computer and share the txt file for the Prebuild Database like Food/Retail Database?


I have redesigned my entire setup. It no longer resembles that database. I will be sharing my new setup soon but it still needs some work. I think what causes that error is mapping for departments somewhere gets saved when that department no longer exists. But I have never been able to pinpoint it.

BTW if its only the departments causing it… it is safe to export everything BUT departments and then just manually make them again after import. Everything will work.

BTW my setup now still runs the same and still has the same features it is just a lot smoother less clunky and does it more naturally without all the departments etc. I am hoping to finish it up and let you guys test it out in next couple days.

PS I have seen that error with Customer Entity Type as well. I have never been able to figure out what causes it. Nor can I duplicate it. It makes me think it was something I did across version upgrades that probably was a naming fluke and would not happen now. I never dug deep into the Database to figure it out, I probably could if I did that.

I think i found the error. Please help me fix it.
###These entity types linked to ticket types but does no exists in export file:
Sales Ticket>Customers
Sales Ticket>Tables
If i don’t export Sales Ticket and Customer, Tables it will be OK.

It looks like you used my database… if thats the case then its the database that has the Customers entity type that is error. I think its ONLY the customer entity type Customers. Try exporting everything but Customers entity type.