How to pass null values into stored procedure via Entity Framework?

asp.net-mvc-4 entity-framework entity-framework-4 entity-framework-6 sql-server

Question

Entity Framework is integrated into an ASP.NET MVC 4 application I'm utilizing.

Conditionally passing null values is what I want to do, so let's assume I pass a value ifDeptID then it ought to display a list of solely passed values.DeptID , and if succeedDeptID = NULL then it ought to be in all departments.

I created a method by checkingDeptID and it produces what is desired (ifDeptID is null , all rows are then displayed).

But the following Entity Framework code does not work when I try to feed null values through it.

IdleTicketsChecker.Data.Test11Entities objModel = new Data.Test11Entities();
List<GeResult_Result> objTicketList =ExecuteCustomStoredProc<GetIdleTicketsByMinutes_Result>("GeResult", " @DeptID",
new SqlParameter("DeptID", DeptID)).ToList();

Know why this is the case?

1
2
10/12/2015 12:13:01 PM

Accepted Answer

ZZZ_tmp
4
10/12/2015 12:14:46 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow