Linq FromSqlRaw - Data is Null. - Comments Field Varchar Null RRS feed

  • Question

  • User-893002196 posted

    Hi All,

    I got this;

    var result = _context.Set<spCallResult>().FromSqlRaw("exec [dbo].[spCallVal] @XX={0}", xx).ToList();

    System.Data.SqlTypes.SqlNullValueException: 'Data is Null. This method or property cannot be called on Null values.'

    My Comments field is varchar(max) null

    How to resolved this in FromSqlRaw?




    Thursday, March 11, 2021 5:01 PM


  • User475983607 posted

    How to resolved this in FromSqlRaw?

    Stop passing a null value to the procedure?  Perhaps try a it of lite troubleshooting.  Set a break point and check what value xx contains.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, March 11, 2021 6:38 PM