LastName = "O'Leary"
Conn.Execute "INSERT (LastName) VALUES ('" & LastName & "')"
<%
FUNCTION theFIX( theVariable )
theFIX=Replace(theVariable, "'", "''")
' this replaces a single apostrophe ( ' ) with two single apostrophes ( ''). Note: two single apostrophes, not one quotation mark
END FUNCTION
%>
Now use the function in the string:
Conn.Execute "INSERT (LastName) VALUES ('" & theFIX(Request("LastName")) & "')"