我很困惑,因為查詢在使用Entity Framework的原始SQL查詢時只返回一列的不同數據(參見下面的屏幕截圖)。
正確的結果當然是我直接從SQL Server查詢數據庫時得到的結果。
當然,我在同一個數據庫和同一台服務器上執行完全相同的查詢。我正在尋找相同的專欄。
編輯:這是LigneFacture類:
public class LigneFacture
{
[Required]
public string Entite { get; set; }
public decimal NumFacture { get; set; }
[Required]
[StringLength(2)]
public string TypeTransaction { get; set; }
[Required]
public DateTime DateFacture { get; set; }
[StringLength(10)]
public string CodeClient { get; set; }
[StringLength(100)]
public string NomClient { get; set; }
[Required]
[StringLength(10)]
public string CodeProduit { get; set; }
[StringLength(150)]
public string NomProduit { get; set; }
[StringLength(10)]
public string CodeLabo{ get; set; }
[StringLength(150)]
public string Laboratoire { get; set; }
[Required]
[StringLength(25)]
public string Numlot { get; set; }
public DateTime Peremption { get; set; }
public decimal Quantite { get; set; }
public decimal ValeurHt { get; set; }
public decimal ValeurRz { get; set; }
public decimal ValeurTva { get; set; }
public decimal PuAchat { get; set; }
public decimal PuPpa { get; set; }
public decimal PuDemi { get; set; }
public decimal PuCess { get; set; }
//This field is causing the problem (it's declared as int in the database as well)
public int Ligne { get; set; }
public string HreString { get; set; }
public int AnneeTransaction { get; set; }
public int MoisTransaction { get; set; }
public decimal TauxRemise { get; set; }
public string Zone { get; set; }
public int Colis { get; set; }
}
其餘的值完全相同。