Ошибки с кодами для удаления с помощью linq
Я столкнулся с проблемой удаления данных с помощью поля со списком. Ошибка подтолкнула меня, я понятия не имею, как ее решить. Кто-нибудь может помочь мне об этом?
private void btnDel_Click(object sender, EventArgs e)
{
using (testEntities Setupctx = new testEntities())
{
var Lo = Convert.ToInt16(cbLocationData.SelectedValue);
var DeleteLocation = (from delLocation in Setupctx.locations
where delLocation.Location1 == Lo
select delLocation).Single();
Setupctx.DeleteObject(DeleteLocation);
Setupctx.SaveChanges();
this.Delete_Location_Load(null, EventArgs.Empty);
MessageBox.Show("Selected Shift Timing Has Been Deleted.");
}
}
Частьwhere delLocation.Location1 == Lo
показывая мне следующую ошибку
Operator '==' cannot be applied to operands of type 'string' and 'short'.
Ваша помощь будет принята с благодарностью.