Pass NULL value to stored procedure in C#

        


We can Pass null or String as parameter to store procedure




public dynamic GetEmpdata(int EmployeeID)
        {
            dynamic EmployeeIDs = EmployeeID;

            string Department=null;

            var Getdata = _context.Employee.FromSqlRaw("dbo.SP_
GetEmpdata    @p0 ,@p1 ",      parameters: new[] { EmployeeIDs , Department}).ToList();
            return Getdata ;
        }




We will take string department parameter as null .it will work as empty String and this will return value if store procedure work fine with null data.

No comments:

Post a Comment