Last post Apr 21, 2008 02:18 PM by gunteman
Apr 20, 2008 04:41 PM|extreme.boredom|LINK
Apr 20, 2008 07:23 PM|gunteman|LINK
Apr 21, 2008 03:10 AM|Mikesdotnetting|LINK
The problem with Access is that you can't parametise an IN clause, which is the approach you should take: SELECT DISTINCT roomCode FROM RoomFacilities WHERE facilityID IN (1,4,7). That really only leaves you with dynamic SQL as an option - building up
a comma-separated list of values to concatenate into the IN clause. That means your server side validation is very important - make sure that the values are the right data-type, and that single quotes are escaped if the values are strings.
Loop through the CheckBoxList and find items that have been selected, If they have, build them into a comma-separated string. Then your SQL becomes: "SELECT DISTINCT roomCode FROM RoomFacilities WHERE facilityID IN (" + MyValidatedCommaSeparatedString
Apr 21, 2008 02:18 PM|gunteman|LINK
I would assume that it's possible to parametrize an IN clause in Access, using the last method I described in the linked post. However, I will be a bit more tricky, using positional parameters instead of named parameters.