The .NET project that works is on .NET framework 4.6.1. The one that does not work is on .NET framework 4.7.2. This is the Function:
return DAL.DALGeneral.SelectScalar("GetYearName", new Dictionary<string, object>() { { "Year", year } }).ToString();
This is the Error message:
[NullReferenceException: Object reference not set to an instance of an object.]
DAL.DALGeneral.GetConnectionString(String DataBase) 83
DAL.DALGeneral.SelectScalar(String spName, Dictionary`2 parameters, String DataBase, String ConnectionString) 123
OnlineYudGimelDaledSignIn.Models.LookUp.GetYearName(Int32 year) in C:\Users\giln\source\repos\OnlineYudGimelDaledSignIn\OnlineYudGimelDaledSignIn\Models\LookUp.cs:58
OnlineYudGimelDaledSignIn.Site.Page_Load(Object sender, EventArgs e) in C:\Users\giln\source\repos\OnlineYudGimelDaledSignIn\OnlineYudGimelDaledSignIn\Site.Master.cs:29
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) 52
System.Web.UI.Control.OnLoad(EventArgs e) 97
System.Web.UI.Control.LoadRecursive() 61
System.Web.UI.Control.LoadRecursive() 134
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) 693
Im stumped as to why, the same function with the same arguments works from an other project.
I tried sending different arguments to the function and i get different error, but i need it to be these arguments.
CodePudding user response:
Ok, so i had a missing connection string in the web.config file in the second project. I didn't realize dll reference uses the current project config file, and not his own somehow.