Question Locked

Infinite, multiple text values from a single textbox - comma seperated

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I want to use a single textbox to gather one or more (no limit) airport codes for criteria in a select query. Examples:

Prompt: Airports?
Response: ABY, CSG, AHN
or another response:
Response: MOB
or none at all where it would display all records.

I am very unfamiliar with coding.

2 replies

by tony hopkinson

for you without knowing more than you've let on.
Some will leave you open to SQL injection attacks as well, which may or may not be a consideration.

Basically you can take the csv string client side and build a query, or you can pass it server side and do it through a stored procedure.

Response =" ABY, CSG, AHN" for instance

could be parsed into 'ABY', 'CSG', 'AHN' and then used in a query like
"Select * From Airports Where AirportCode in( " + quotedResponse" + ")"

for isntance.

You could do that in stored proc as well, there are some other ways, but they are more complex and involve coping with inputs like

ABY, CSG, ABY.

Response = "", you will have to test for...

This discussion is closed to new replies.