I have a query done through ASP.net to an access database.
The query goes: Select * from TableName where where sLastName Like ' & strName & '
The issue I am encountering is when I try to query someone by the name "O'neal". I get an OledbException error. I know the apostrophe is creating the issue so this is what I am trying:
If strTemp.IndexOf("'", 0, 1) Then
strTemp.Replace(Chr(39), Chr(34)) ' to include only a quote instead of a single quote
However, the value in the strTemp remains the same as if the replacement never happened. What am I doing wrong?