我正在做一个搜索索引。我让它工作得很好,但我无法在我的搜索中合并 ItemID(项目编号),因为我无法将 TextBox.Text 中的 String 转换为 int 以使其成为可比较的类型。
var q = (from t0 in db.Item
join t1 in db.Categories on t0.CategoryID equals t1.CategoryID
join t2 in db.Divisions on t0.DivisionID equals t2.DivisionID
where t0.DivisionID == DDLInt &&
//Contains
(t0.ItemName.Contains(txtSearch.Text.Trim()) ||
t0.Email.Contains(txtSearch.Text.Trim()) ||
t0.Description.Contains(txtSearch.Text.Trim()) ||
t0.Phone.Contains(txtSearch.Text.Trim()) ||
t0.ItemID.Equals(txtSearch.Text.Trim()))
// ^ This is the line where
// it breaks because it is not a comparable type
group t0 by new
{
我不确定如何转换或解析它并且仍然可以正常搜索。