如果我通过邮政编码搜索城市,我将所有城市与邮政编码进行比较,但是剪切了邮政编码 - 例如我写了01169我得到了所有城市,但我的邮政编码被修剪为116。
我有以下搜索来源:
public dynamic GetCityByZip (string ZipCode)
{
BindingList<Orte> cities = new BindingList<Orte>();
var result = (from ort in _model.Orte
where ort.PLZ == ZipCode
select ort).ToList();
cities = new BindingList<Orte>(result);
return cities;
}
以表格搜索:
private void txtZipCode_TextChanged(object sender, EventArgs e)
{
if (txtZipCode.Text.Length == 5)
{
BindingList<Orte> result = _getDataFromDatabase.GetCityByZip(txtZipCode.Text);
cboCities.DataSource = result;
cboCities.DisplayMember = "Ort";
cboCities.ValueMember = "Ort";
}
}
有人有想法吗?
此致 DOM