PDA

View Full Version : سوال: خطای unable to cast object of type



hamid_14
دوشنبه 17 آذر 1399, 02:01 صبح
سلام
لطفا راهنمایی کنید مشکل این خطا چیه؟
unable to cast object of type "model" to type 'system.data.datarowview
مدل

public partial class FiscalYear {
public int EId { get; set; }
public string Description { get; set; }
public string StartDate { get; set; }
public string EndDate { get; set; }
public Nullable<int> Creator { get; set; }
public Nullable<System.DateTime> CreationDate { get; set; }
public Nullable<int> LastModifier { get; set; }
public Nullable<System.DateTime> LastModificationDate { get; set; }
}

کد

DataRowView currentrow = (DataRowView)Table1BindingSource.Current;
MessageBox.Show(currentrow["EId"].ToString());

Mahmoud.Afrad
سه شنبه 18 آذر 1399, 01:33 صبح
دیتاسورس چیه؟

hamid_14
سه شنبه 18 آذر 1399, 19:34 عصر
مشکل برطرف شد باید بجای DataRowView کلاس مدل معرفی می کردم. تشکر