I have my code below:
User user = new User();
WFMModel db = new WFMModel();
SqlParameter param1 = new SqlParameter("@username", username);
SqlParameter param2 = new SqlParameter("@password", password);
SqlParameter param3 = new SqlParameter("@Version", Version);`
var userData = db.Database.SqlQuery<User>("usp_Rep_App_DotNet_Validate_User_new @username,@password,@Version",
param1, param2, param3);
And I have my User class as below:
public class User
{
public string UserID;
public string FirstName;
public string LastName;
public string Message;
public string Department;
}
But when the code executes, I get the error: An exception of type 'System.NullReferenceException' occurred in EntityFramework.dll but was not handled in user code.
When I run the stored procedure, I get the data without any issues (no nulls as well).
Any idea what's going on? Thanks in advance.