arichexe
asked on
handling glitches in sql string
I need to include glitches within a query string, but keep getting an "unterminated string" error. How would I modify the below to accept glitches within the Name field?
Set conn = CreateObject("ADODB.Connec tion")
conn.Open MSSqlConnStr
MyName = "O'Brien"
MySql = "SELECT * FROM MyTable WHERE Name = '" & MyName & "'"
Set rs = conn.Execute(MySql)
If Not rs.EOF Then MsgBox("Found Name!")
rs.Close
conn.Close
Set conn = CreateObject("ADODB.Connec
conn.Open MSSqlConnStr
MyName = "O'Brien"
MySql = "SELECT * FROM MyTable WHERE Name = '" & MyName & "'"
Set rs = conn.Execute(MySql)
If Not rs.EOF Then MsgBox("Found Name!")
rs.Close
conn.Close
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.