我担心我错过了显而易见的事情。下面的代码在 SaveChanges() 上产生除以零错误。我几乎到处寻找可能的原因,但找不到。有人可以指出我正确的方向。
谢谢
Public Sub AddDetailRecords()
Dim products As List(Of Product)
'code that builds a list of products
For Each prd In products
Dim eqDetail As New EmployeeQuoteDetail
Dim rateRec As Rate = RateRecord(prd)
eqDetail = DetailRecordForProduct(prd, eqDetail)
eqDetail.netRate = rateRec.rate1
eqDetail.ratePer = rateRec.ratePer
db.EmployeeQuoteDetail.Add(eqDetail)
Next
db.SaveChanges()
End Sub