在 Linq to SQL 中,我试图搜索 double 类型的值:
var q = from a in db.GetTable<HKKS_Medlemmer>()
from g in db.HKKS_Get_grader_Kun_Grad(Convert.ToInt32(a.Skif))
where a.Aktiv == true &&
(a.Skif.ToString().StartsWith(SearchValue) ||
SqlMethods.Like(a.Navn, "%" + SearchValue + "%") ||
SqlMethods.Like(a.Mellemnavn, "%" + SearchValue + "%") ||
SqlMethods.Like(a.Efternavn, "%" + SearchValue + "%") ||
SqlMethods.Like(a.Adresse, "%" + SearchValue + "%") ||
SqlMethods.Like(a.Telefon, "%" + SearchValue + "%") ||
SqlMethods.Like(a.Mobil, "%" + SearchValue + "%") ||
SqlMethods.Like(a.PostNr, "%" + SearchValue + "%") ||
SqlMethods.Like(a.town, "%" + SearchValue + "%") ||
SqlMethods.Like(a.mail, "%" + SearchValue + "%"))
orderby a.Navn
select new
{
Grad = g.Grad,
Skif = a.Skif,
Navn = a.Navn,
Mellemnavn = a.Mellemnavn,
Efternavn = a.Efternavn,
Adresse = a.Adresse,
Telefon = a.Telefon,
Mobil = a.Mobil,
PostNr = a.PostNr,
town = a.town,
mail = a.mail,
Picture = "http://www.hkks.dk/" + a.Picture,
Age = db.fn_GetAge((a.CPR), DateTime.Now),
Cpr = a.CPR
};
我也试过这个:
var u = from a in db.GetTable<HKKS_Medlemmer>()
from g in db.HKKS_Get_grader_Kun_Grad(Convert.ToInt32(a.Skif))
.Where (p => Object.Equals(a.Skif, SearchValue))
orderby a.Navn
select new
{
Grad = g.Grad,
Skif = a.Skif,
Navn = a.Navn,
Mellemnavn = a.Mellemnavn,
Efternavn = a.Efternavn,
Adresse = a.Adresse,
Telefon = a.Telefon,
Mobil = a.Mobil,
PostNr = a.PostNr,
town = a.town,
mail = a.mail,
Picture = "http://www.hkks.dk/" + a.Picture,
Age = db.fn_GetAge((a.CPR), DateTime.Now),
Cpr = a.CPR
};
但是,如果我正在搜索 994 并期望结果给我 99469 的记录,他们都没有给我正确的结果。
有什么建议么?