Thanks for the Idea, but doesn't solve my problem.
I am using SQL Server 2000 ( maybe different for 2005 ) .
I have tried the # of items to return , and yes it only returns the top N.
However the SQL Statement doesn't explicitly say "SELECT TOP 10..." ( I put a trace on the SQL Server ) .
This is a problem because it is obviously returning all rows from SQL Server and the only putting the first 10 into the collection. I have limited resources on the machine that I am running this code on.
Basically what happenned the other night is that I had the web service going, there was something slighly wrong with the data it was requestiong, so it selected a large part of the table , which resulted in the whole VPS going down because it ran out of resources.
I wouldn't have thought it was too difficult to add "TOP 10 " into the Dynamic SQL and would be more efficient than returning all the data and just putting the first 10 rows.
Maybe I am missing something?
Thanks
Marty