This project has moved. For the latest updates, please go here.

Cannot access destination table

Jan 16 at 10:00 AM
Edited Jan 16 at 11:31 AM
Hi
I'm getting below exception while trying to insert with BulkInsert

Exception occured Cannot access destination table '[].[FCR_fleet_newtable]

public void UpdateFleet(List<FcrFleetViewModel> fleetList)
    {
        using (var context = new ETollingEntities())
        {
            using (var dbContextTransaction = context.Database.BeginTransaction())
            {
                try
                {
                    context.Database.ExecuteSqlCommand("TRUNCATE TABLE FCR_fleet_newtable ");
                    var entities = fleetList.Select(Mapper.Map<FCR_fleet_newtable>).ToList();
                    context.BulkInsert(entities);
                    context.SaveChanges();
                    dbContextTransaction.Commit();
                }
                catch (Exception ex)
                {
                    dbContextTransaction.Rollback();
                }
            }
        }
    }