This project is read-only.

Conditional statement with 'in'

Feb 11, 2010 at 1:59 PM
Edited Feb 11, 2010 at 1: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 5:20 PM

The first method will work. The second would not.

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

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

Feb 23, 2010 at 6: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 2: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.