可空类型用途主要是从数据库读取数据有可能为空,而不是插入使用,插入数据都要进行验证,如果要插入数据库的null,则使用DBNull.value

判断取出的数据是否为数据库中的null,如果是则赋值给可空的datetime类型的Lockdatatime 属性

 tseat.Lockdatatime = reader.IsDBNull(5) ? null : (DateTime?)reader.GetDateTime(5);

判断取出的数据是否为数据库中的null,如果是则赋值给可空的int类型的Testint 属性
 tseat.Testint = reader.IsDBNull(6) ? null : (int?)reader.GetInt32(6);