c# - LINQ to SQL use of => operand on String not allowed -
possible duplicate:
string1 >= string2 not implemented in linq sql, workarround?
to give brief summary of want achieve have table called application , stores application version numbers. contents of table example is
applicationid versionid 1 r1.01.01.01 2 c8.00.00.01 2 c8.00.00.02 2 r8.10.00.00 2 r8.20.00.02 2 r9.00.00.01 2 r9.00.00.02 2 r9.00.00.03 3 r7.00.30.00
when doing query in tsql, there no problems , correct results (take note versionid nvarchar type)
select * applications versionid >= 'r9.00.00.01' , applicationid = 2
but when start using linq sql such
var applications = v in db.applications v.versionid.startswith("r") && v.versionid >= "r9.00.00.01" && v.applicationid == 2 orderby v.versionid select v;
then error "operator >= cannot applied operands of type 'string' , 'string'
how achive in linq sql without changing on database side?
use string.compare()
?
&& string.compare( v.versionid , "r9.00.00.01" ) >= 0
Comments
Post a Comment