Replies Back to Article
Using the IN Operator to select multiple records

I tried this once, i could never get the insert loop to work, and neither did anyone here since i asked 4 times and spend many many hours on this, but i write to say that the loop adds nrs to the checkbox, if you have 100 cities and the first checkbox is called checkCity then the last in the array will be checkCity99.
I tried this just once in coldfusion and it just worked, cfquery insert into and voila it worked, crazy ! I wanted this for my knowledge base, select knowledge boxes to look for and in the admin section the same thing, only with insert. I guess when it's all on paper it will just be a matter of a few cfquery's and be done with it, glad i dumped asp. Wish i could dump the strict documenting and change requests and everything as well.
Dennis

Hi Dennis,
i'm a bit suprised that this part gave you trouble. In my case that was the easy part. But you might have mixes to things up, maybe. I am very sure that all checkboxes have the same name. And i am very sure that the info in the QS does too. But of course in a one dimensional array the values in the array get numbered.
But because you named the variable (the array) checkCity, this is still something you can use in a db-query.
The result of my form are like 45 or 46 or 47 and therecords in database are for example 46 or 46/1-2 or 46/3-4
In it possible to insert wildcart please ?
Is there some separate character tu use it ?
Thank you

Hi Ran,
I don't see why it shouldn't be possible.
Haven't tried it out, but something like this could work (in a quick and dirty way):
<%
QSCity = Request.Querystring("ReCity")
StrCities = Replace( QSCity, ", ", "'*,*'" )
%>
it don't work
and the version with OR don't work neither
it seem to be a bug from MS SQL
Ran
In that case you'd need to store your data in a better format, or make sure that users cannot enter things like 45 1/2 using validation techniques, otherwise.
For instance if you used a float field, that would be 45.5 and then you could use BETWEEN in SQL.