I am writing a program to search an Access Database using SQL and ASP. In my database i have cells that contain apostrophes in them... that poses a problem when someone enters and single quote to search because the SELECT * FROM table WHERE name=mike's gives me an error because of the apostrophe.
How can i do this?
right, the apostrophe is a SQL delimiter
what you can do is run the replace() on your search query. substitute all apostrophes to lets say a pound sign. then when you want to display the result run the replace() again to substitute the pound sign with theapostrophe. make sense?
Have a look at this faq from 4Guys as it explains the problem and shows the solution.