[英]I can't retrieve my data from the tables ASP.NET Core MVC
之前試過,正常,不知道為什么會這樣。 我無法從表中檢索我的數據。 只有這張表無法獲取數據。 另一方面,一切正常
錯誤信息
SqlNullValueException:數據為 Null。 不能對 Null 值調用此方法或屬性。
數據計數截圖
Controller代碼
public IActionResult IndexWGI()
{
IEnumerable<VerDummyWellGeneralInformation> wgi = _db.VerDummyWellGeneralInformations;
return View(wgi);
}
我所有其他人的索引都一樣,但在這個上不會得到任何數據
編輯 1 Model 代碼
public partial class VerDummyWellGeneralInformation
{
[Key] public int No { get; set; }
public string? Well { get; set; }
public string? OriginalOwnerCompany { get; set; }
public string? OwnerCompany { get; set; }
public string? OriginalOperatorCompany { get; set; }
public string? OperatorCompany { get; set; }
public string? WellName { get; set; }
public string? WellShortName { get; set; }
public string? LocationName { get; set; }
public string? UniqueWellId { get; set; }
public string? BoreholeName { get; set; }
public string? BoreholeShortName { get; set; }
public string? UniqueBoreholeId { get; set; }
public string? AliasName { get; set; }
public string? Field { get; set; }
public string? Structure { get; set; }
public string? Basin { get; set; }
public string? District { get; set; }
public string? County { get; set; }
public string? Province { get; set; }
public string? Country { get; set; }
public string? IdPepmaps { get; set; }
public string? Latitude { get; set; }
public string? Longitude { get; set; }
public string? BottomLatitude { get; set; }
public string? BottomLongitude { get; set; }
public string? Easting { get; set; }
public int Northing { get; set; }
public string? BottomEasting { get; set; }
public string? BottomNorthing { get; set; }
public string? UtmZone { get; set; }
public string? Elipsoid { get; set; }
public string? Datum { get; set; }
public string? SourceOfCoordinate { get; set; }
public string? VerficationStatusOfCoordinate { get; set; }
public string? WellLocation { get; set; }
public string? DrillingMeasuredFrom { get; set; }
public string? LogMeasuredFrom { get; set; }
public string? PermanentDatum { get; set; }
public string? Kb { get; set; }
public string? Df { get; set; }
public string? Rt { get; set; }
public string? Gl { get; set; }
public string? DrillingBottomDepthTvd { get; set; }
public string? DrillingBottomDepthMd { get; set; }
public string? DrillingBottomDepthTvdss { get; set; }
public string? LoggingBottomDepthMd { get; set; }
public string? UnitMeasurementMeterFeet { get; set; }
public string? RigName { get; set; }
public string? SpudDate { get; set; }
public string? FinalDrillTotalDepthDate { get; set; }
public string? CompletionDate { get; set; }
public string? AbandonmentDate { get; set; }
public string? DrillingCompany { get; set; }
public string? LoggingCompany { get; set; }
public string? BoreholeProfile { get; set; }
public string? RecordedBy { get; set; }
public string? WitnessedBy { get; set; }
public string? WellStatus { get; set; }
public string? SeismicReference { get; set; }
public DateTime? RowCreated { get; set; }
}
Model 生成器代碼
modelBuilder.Entity<VerTempWellGeneralInformation>(entity =>
{
entity.ToTable("VER_TEMP_WELL__GENERAL_INFORMATION", "db_owner");
entity.Property(e => e.AbandonmentDate)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Abandonment_Date");
entity.Property(e => e.AliasName)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Alias_Name");
entity.Property(e => e.Basin)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.BoreholeName)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Borehole_Name");
entity.Property(e => e.BoreholeProfile)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Borehole_profile");
entity.Property(e => e.BoreholeShortName)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Borehole_Short_Name");
entity.Property(e => e.BottomEasting)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Bottom_Easting");
entity.Property(e => e.BottomLatitude)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Bottom_Latitude");
entity.Property(e => e.BottomLongitude)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Bottom_Longitude");
entity.Property(e => e.BottomNorthing)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Bottom_Northing");
entity.Property(e => e.CompletionDate)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Completion_Date");
entity.Property(e => e.Country)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.County)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.Datum)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("DATUM");
entity.Property(e => e.Df)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("DF");
entity.Property(e => e.District)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.DrillingBottomDepthMd)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Drilling_Bottom_Depth_MD");
entity.Property(e => e.DrillingBottomDepthTvd)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Drilling_Bottom_Depth_TVD");
entity.Property(e => e.DrillingBottomDepthTvdss)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Drilling_Bottom_Depth_TVDSS");
entity.Property(e => e.DrillingCompany)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Drilling_Company");
entity.Property(e => e.DrillingMeasuredFrom)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Drilling_Measured_from");
entity.Property(e => e.Easting)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.Elipsoid)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("ELIPSOID");
entity.Property(e => e.Field)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.FinalDrillTotalDepthDate)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Final_Drill_Total_Depth_Date");
entity.Property(e => e.Gl)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("GL");
entity.Property(e => e.IdPepmaps)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("ID_PEPMAPS");
entity.Property(e => e.Kb)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("KB");
entity.Property(e => e.Latitude)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.LocationName)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Location_Name");
entity.Property(e => e.LogMeasuredFrom)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Log_Measured_from");
entity.Property(e => e.LoggingBottomDepthMd)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Logging_bottom_depth_MD");
entity.Property(e => e.LoggingCompany)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Logging_Company");
entity.Property(e => e.Longitude)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.No)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.Northing)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.OperatorCompany)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Operator_Company");
entity.Property(e => e.OriginalOperatorCompany)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Original_Operator_Company");
entity.Property(e => e.OriginalOwnerCompany)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Original_Owner_Company");
entity.Property(e => e.OwnerCompany)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Owner_Company");
entity.Property(e => e.PermanentDatum)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Permanent_Datum");
entity.Property(e => e.Province)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.RecordedBy)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Recorded_by");
entity.Property(e => e.RigName)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Rig_Name");
entity.Property(e => e.RowCreated)
.HasColumnType("datetime")
.HasColumnName("ROW_CREATED");
entity.Property(e => e.Rt)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("RT");
entity.Property(e => e.SeismicReference)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Seismic_Reference");
entity.Property(e => e.SourceOfCoordinate)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Source_of_Coordinate");
entity.Property(e => e.SpudDate)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Spud_Date");
entity.Property(e => e.Structure)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.UniqueBoreholeId)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Unique_Borehole_ID");
entity.Property(e => e.UniqueWellId)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Unique_Well_ID");
entity.Property(e => e.UnitMeasurementMeterFeet)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Unit_measurement_METER_FEET");
entity.Property(e => e.UtmZone)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("UTM_ZONE");
entity.Property(e => e.VerficationStatusOfCoordinate)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Verfication_Status_of_Coordinate");
entity.Property(e => e.Well)
.HasMaxLength(512)
.IsUnicode(false);
entity.Property(e => e.WellLocation)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Well_Location");
entity.Property(e => e.WellName)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Well_Name");
entity.Property(e => e.WellShortName)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Well_Short_Name");
entity.Property(e => e.WellStatus)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Well_Status");
entity.Property(e => e.WitnessedBy)
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnName("Witnessed_by");
});
數據庫表截圖SS
抱歉,我意識到我的 model 數據類型已被查找和替換更改。
public int Northing { get; set; }
那是改名的代碼
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.