1. Problem description:
Unhandled Exception: System.Data.SqlTypes.SqlNullValueException: Data is Null. This method or property cannot be called on Null values.
at System.Data.SqlClient.SqlBuffer.get_DateTime()
at System.Data.SqlClient.SqlDataReader.GetDateTime(Int32 i)
EF Core model read a Null date field.
solution:
1. Set the date as nullable type
public class Student
{
public int Id { get; set; }
// public DateTime Entry_Date { get; set; }
public DateTime? Entry_Date { get; set; }
}
2. Modify data.
Read More:
- ‘Conversion failed when converting date and/or time from character string.DB-Lib error message 241,
- MySQL error: column ‘ID’ in field list is ambiguous
- Converting string object into datetime type in pandas
- django.db.utils .IntegrityError: NOT NULL constraint failed: blog_ blog.author_ ID error resolution
- Common errors and modification methods of findbug
- 1、 Java 8 date and local date
- Error: 7884, Severity: 20, State: 1
- Get the current date in Python
- Spring boot thymeleaf crud implements simple functions of adding, deleting, modifying and querying
- Solution to error 1452: cannot add or update a child row: a foreign key constraint failures in MySQL
- [Qt] error: call to non-static member function without an object argument
- Solution of error converting data type varchar to datetime in SQL Server
- Error converting data type nvarchar to datetime
- MySQL partitions the existing tables of the data table
- Usage of NVL in SQL
- 【EF】An error occurred while updating the entries. See the inner exception for details.
- Several calculation methods of Python execution time
- Modification method of starting value of MySQL auto increment ID
- Definition of bracket type in typescript
- assigning to rvalue