Forum Moderators: open
This text will then be inserted into a memo filed in an access database.
How can I account for special characters such as:
single quotes (')
commas (,)
etc.. that would possibly cause the INSERT statement to crash?
Is there a function in ASP that will allow me to escape all these special characters?
Thanks
sub formatString(strToBeFormatted)
dim tString
tString = replace(strToBeFormatted, "'", "*")
tString= replace(tString, "<", "<")
...etc
formatString = tString
end sub
then you can build you SQL string as:
sSQL = "Insert into tbl_Table(memo_field) value ('" & formatString(request("theField")) & "')"
then run it....
this hasn't been tested so it might need some tweaks
Thanks for the advise...
I thought about writing something myself, but that would mean I would have to take into consideration all possible characters that may cause the statement to crash right?
This may not be that big of an issue, but I thought there may be a quick and easy way to accomplish the same thing.
Thanks again for your reply along with the code.
I appreciate it!