How to avoid problem when using Apostrophe in a SQL command
S T E P - 1
- For example, we need to add a text "He's car" by using SQL command.
S T E P - 2
- When you use the SQL Command:
<%
strSQL = "Insert into pComment (Comment) values('He's car... ')"
oConn.Execute strSQL
%>
- This will get problem when you use the Insert command:
S T E P - 3
- How to solve the Apostrophe (') problem by using the CHR() function?
- Below is the solution:
<%
strSQL = "Insert into pComment (Comment) values('He" & chr(39) & "s car... ')"
oConn.Execute strSQL
%>
No comments:
Post a Comment