Strange SQL Error when Fetching a typed list

Posts   
 
    
MarcoP avatar
MarcoP
User
Posts: 270
Joined: 29-Sep-2004
# Posted on: 11-Sep-2006 21:50:57   

Does anyone know if there is a limit to the amount of comparisons that can go in a where clause? Basically, the user can do a search which returns 2500 header records and I need to fetch the child records. I do this in two database calls. So, in my second call, I have a huge where clauses and I get a "please disregard the results" error from sql server. Any clues?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 12-Sep-2006 07:05:00   

How does the where clause looks like? and how do you build it?

MarcoP avatar
MarcoP
User
Posts: 270
Joined: 29-Sep-2004
# Posted on: 12-Sep-2006 14:11:15   

Walaa wrote:

How does the where clause looks like? and how do you build it?

I simply enumerate though a collection and build my predicate. When I tried using the 'IN' clause, i just populated an arraylist and passed this. Note, I think it has to do with ado.net or something, b/c it works fine in query analyzer.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39927
Joined: 17-Aug-2003
# Posted on: 12-Sep-2006 15:17:20   

Too many elements. There's a limit on how much parameters can be placed inside an IN() clause or how much parameters can be sent to the server.

Frans Bouma | Lead developer LLBLGen Pro
MarcoP avatar
MarcoP
User
Posts: 270
Joined: 29-Sep-2004
# Posted on: 12-Sep-2006 15:45:05   

Ok thanks! I just ended up created a sproc with a temp table.