LINQ - syntex for "where and" in select - Asked By D N C on 14-Sep-11 05:31 AM
Hello,
Is this syntax right?
From p in x.y where ( p.col1 = "something" and p.col2= "something") select p ?????
iam using such a query in WPF-Vb.net application and its not giving the proper result.
Kindly help ASAP
Thank You :)
Riley K replied to D N C on 14-Sep-11 05:44 AM
The operator that you are specifyig is wrong
use
'=='
change the query like this
var result= From p in x.tablName where ( p.col1 == "something" and p.col2== "something") select p;
Cheers
D N C replied to Riley K on 14-Sep-11 05:59 AM
That too was not working. giving an error. in Vb.net using "==" is not possible i think.
any other suggestions????
pete rainbow replied to D N C on 14-Sep-11 07:45 AM
in what way is it not working?
what is it that you are getting?
D N C replied to pete rainbow on 14-Sep-11 07:52 AM
actuallly it was showing no data earlier.
when i used ==, it threw an error like 'something expected'
but then i did like this:
dim str1 as string = "Something1"
dim str1 as string = "Something2"
and executed the same query as "from p in x.y where (p.col1=str1 and p.col2=str2) select p"
now its giving the expected result. :)
Thanks all for your time and interest...