I am working on an application that accepts a document as an upload, an excel sheet with multiple values. It is breaking and not uploading... I have located where it is breaking but I am having problems understanding this exact LINQ syntax.
public static List<PoolManager> getPoolManagersLoadedinMaster()
{
using (HRCMSEntities context = new HRCMSEntities())
{
HRCompInfo compInfo = new HRCompInfo();
DataTable dtCurrYear = compInfo.getConfiguration("CurrentYear");
var currYear = Convert.ToInt32(dtCurrYear.Rows[0]["Config_Val"].ToString());
var planningManagerQuery =
from COMP_REC_ENC in context.COMP_REC_ENC.Where(m => m.Year == currYear)
select new PoolManager
{
Planning_manager_ID = COMP_REC_ENC.Planning_Manager_ID
};
var planningManagerList = planningManagerQuery.Distinct().ToList();
return planningManagerList;
}
}
This code is breaking when it tries to run
PlanningMangerList = planningManagerQuery.Distinct().ToList()
I checked the table and the data is there. Can someone help me decipher why this code is breaking on that exact part? Theories would work just fine... I am getting this error:
ERROR: System.Data.Entity.Core.EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details. ---> System.Data.SqlClient.SqlException: Invalid column name 'Special_6'. Invalid column name 'Special_9_New'. Invalid column name 'Special_10_New'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.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, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior
I did reciently change this project from a SIT database to a DEV database... When it comes to entity framework I did update the connection string catalog but am unsure if the connectionString is a problem when it comes to entity framekwork. I updated it to this.
<add name="HRCMSEntities" connectionString="metadata=res://*/;provider=System.Data.SqlClient
Thanks
PoolManager?