Hello, I have a query that is basically like this:
SELECT foo
FROM bar
where bar.Id in (1,2,3);
I would like to pass the list of Id's in as a single param with IDbDataParameter where the query is formatted:
SELECT foo
FROM bar
where bar.Id in (?ListOfID);
and then have a single param that is a list rather than having to do something like this:
SELECT foo
FROM bar
where bar.Id in (?id1, ?id2, ?id3);
I know this is possible in other data providers can I do this with the standard System.Data classes?
P.S. the reason I want it as a single list param rather than a series of params is because as the number of params changes MySQL will view the query as new and we loose some of the caching optimizations. MySQl basically ends up with one query per number of ID's. This is the same reason I dont just want to manipulate the base SQl as a string, because then I end up with one query per VAULE and that would be worse.