例
select name
from products p
where seq >= '000001' and
seq <= '000910'
這要怎麼在linq中表達?
你或許很直接的用>=/<=運算
字串不支援這樣
卻是有個變通的方式,用「CompareTo」的方式,就可以達到上述的目的了:
===============================
from p in products
where (
p.seq.CompareTo("000001")>=0 &&
p.seq.CompareTo("000910")<=0
)
===============================
參考來源在此,大家加油了