Reputation: 133
I updated my dbml file after adding a new column to the database table in DEV. Everything works in DEV environment. But when deployed to test and production I get this Invalid Column Name exception. Any suggestions?
var CreateUpdateCtx = new MyDataContext(connectionstring);
var Data = vutTable.Accounts.ToList(); //Calling ToList() results in the exception shown below
UPDATE: Added log:
2015-12-01 09:59:04,267 [29] ERROR [BusinessLogic.Managers.EntityManagers.IntegrationManager.Run] An error occured during call of bla bla
Exception message: Invalid column name 'MyNewAddedColumn'.
Stack-trace: at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action
1 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) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource
1 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.Linq.SqlClient.SqlProvider.Execute(Expression query, QueryInfo queryInfo, IObjectReaderFactory factory, Object[] parentArgs, Object[] userArgs, ICompiledSubQuery[] subQueries, Object lastResult) at System.Data.Linq.SqlClient.SqlProvider.ExecuteAll(Expression query, QueryInfo[] queryInfos, IObjectReaderFactory factory, Object[] userArguments, ICompiledSubQuery[] subQueries) at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Execute(Expression query) at System.Data.Linq.Table1.GetEnumerator() at System.Collections.Generic.List
1..ctor(IEnumerable1 collection)
1 source) at BusinessLogic.Managers.Integration.syncTable[T1,T2](IList
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 Table, ITable
1 TableToUpdate) at BusinessLogic.Managers.Integration.Execute() at BusinessLogic.Managers.EntityManagers.IntegrationManager.execute()
Upvotes: 0
Views: 1168
Reputation: 7616
It's look like you have not moved your database changes from your local database or lower environment database to production database. Please verify.
So when you run your Linq2SQL in dev it is working because new column present in local or dev database. But in production DBML try to retrive the value from new column from Accounts table but it is not present and resulting in above error
Upvotes: 0