The better way of doing this is to build a prepared query. Prepared queries are faster and secure compared to the queries written on the fly. You do not have to take care of special characters in prepared statements and they are compiled. Take a look at the Command object of ADODB library or else do a search in the Forum and you will find lots of examples.