Conditional statement with 'in'

Feb 11, 2010 at 12:59 PM
Edited Feb 11, 2010 at 12:59 PM

I would like to do something like:


 ObjectContext.GetObjectSet(Of Item)(New Query.SqlQuery("select * from aan01 where id in {0}", "('602','867','105')"))


Or something like:


 ObjectContext.GetObjectSet(Of Item)("id in {0}","('602','867','105')"))



Is this possible?




Feb 19, 2010 at 4:20 PM

The first method will work. The second would not.

Feb 22, 2010 at 12:07 PM
Edited Feb 23, 2010 at 12:26 PM

Any idea why the second method won't work? Why isn't this supported?

Feb 23, 2010 at 5:08 PM

Currently there is no support for it. The string conditions have been a bit of a mystery to me. Aside from looking through the source code, there isn't much documentation on them. Maybe littleguru could elaborate on the subject.

Mar 8, 2010 at 1:31 PM

I've been looking at the source code myself. The query is compiled as an parameterized query the downside is SQL2005 doesn't support a parameters in an 'in'-clause. So it wouldn't be of any use to even try and implement this.