This topic has been archived. It cannot be replied.
-
工作学习 / 学科技术讨论 / 记得这里有几位LINQ大侠,来求助一下关于如何在LINQ里实现between。
-mfcguy();
2008-11-25
{744}
(#4871602@0)
-
How about using ProductType >= 'A' && ProductType <='C'
-deep_blue(BLUE);
2008-11-26
(#4873091@0)
-
Operator '>=' cannot be applied to operands of type 'string' and 'char'
-mfcguy();
2008-11-26
(#4874172@0)
-
It’s just a prototype. Do I have to write out whole thing?query = query.where(p => p.ProductType.CompareTo(“A”) >=0 && p.ProductType.CompareTo(“C”) <=0);
-deep_blue(BLUE);
2008-11-26
{99}
(#4874205@0)
-
Thanks a lot, it works perfect!
-mfcguy();
2008-11-26
(#4874373@0)
-
Actually you can directly use IEnumerable (base of IQueryable) as datasource of gridview.
-deep_blue(BLUE);
2008-11-26
(#4873139@0)
-
Have you ever tried?if I define query like:
IEnumerable query= from a in db.Products
......
query.Where() query.Between() won't be seen
only I use 'var' instead of 'IEnumerable' can solve this problem, but type 'var' will be dynamically assign into 'IQueryable<>' in run time
-mfcguy();
2008-11-26
{307}
(#4874199@0)
-
Of course you cannot use IEnumerable. You have to use IEnumerable<T>. It means you shouldn’t use anonymous query result. As matter factor, if you use anonymous query result, you’ll also have trouble to pass query result to other layer.
-deep_blue(BLUE);
2008-11-26
(#4874353@0)
-
you reached the point, I had gotten some problem last time when I tried to pass the value of result between objects due to using anonymous query result. Thanks for your words.
-mfcguy();
2008-11-26
(#4874385@0)