나는 가지고 있고 그것에 의해 PriceId
일부 를 얻었고이 오류를 업데이트 PriceGaranties
하여 삭제하려고합니다 .PriceGaranties
Price
다음은 코드입니다.
public void DeletePriceGaranties(int priceId)
{
var deletedPriceGaranties = context.PriceGaranties.Where(p => p.PriceId == priceId).ToList();
foreach (var priceGaranty in deletedPriceGaranties)
{
context.PriceGaranties.Remove(priceGaranty);
context.SaveChanges();
}
}
오류는 다음과 같습니다.
문자열 또는 이진 데이터가 잘립니다. 그 진술서는 만료되었습니다.
최신 정보
모델은 다음과 같습니다.
public class Price
{
public int PriceId { get; set; }
public int ProductId { get; set; }
public int ClassId { get; set; }
public int ClassPartnerId { get; set; }
public int UserId { get; set; }
public decimal Cost { get; set; }
public string Url { get; set; }
public string Description { get; set; }
public DateTime LastUpdate { get; set; }
public bool Enable { get; set; }
public int CostTypeId { get; set; }
public int Value { get; set; }
public Class Class { get; set; }
public Product Product { get; set; }
public User User { get; set; }
public List<OldPrice> OldPrices { get; set; }
public List<PriceColor> PriceColors { get; set; }
public List<PriceGaranty> PriceGaranties { get; set; }
public ClassPartner ClassPartner { get; set; }
}
public class PriceGaranty
{
public int PriceGarantyId { get; set; }
public int PriceId { get; set; }
public int GarantyId { get; set; }
public Comparing.Model.Price.Price Price { get; set; }
}
그리고 모든 문자열 유형은 nvarchar (MAX)입니다.
데이터베이스의 문자열 길이를 추가하려는 것보다 짧게 지정했습니다. 예를 들어 데이터베이스의 varchar 길이를 10으로 설정했지만 추가하려는 문자열은 11, 15, 20 등의 문자입니다. 데이터베이스는 그것으로 무엇을 해야할지 모르기 때문에 초과 문자를 잘라냅니다. 데이터베이스의 필드 길이를 더 큰 길이로 설정해보십시오.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다