Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to deal with the character ' in a SQL string
Dear all,
Please give me some hints to tackle the following problem: - strSQL = "Select location from restaurant where name = '" & strName & "'" rstResult.open strsql, adoconnection, adOpenKeyset, adLockOptimistic ** if the string variable strName contains the character ['], i.e. Benjimin's Restaurant, then error occurs. Thanks in advance! Keith |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
How to deal with the character ' in a SQL string
Try doubling up the quotes before running the SQL
Benjimin''s Restaurant (that's two single quotes, not a double quote) Tim "KS Wong" wrote in message ... Dear all, Please give me some hints to tackle the following problem: - strSQL = "Select location from restaurant where name = '" & strName & "'" rstResult.open strsql, adoconnection, adOpenKeyset, adLockOptimistic ** if the string variable strName contains the character ['], i.e. Benjimin's Restaurant, then error occurs. Thanks in advance! Keith |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Has anyone made a Deal or No Deal Gamebord | Excel Discussion (Misc queries) | |||
Excel-Match 1st text character in a string to a known character? | Excel Worksheet Functions | |||
Insert Character in a String | Excel Programming | |||
Function to return Character Position of Xth character within a string | Excel Programming | |||
Finding a particular character in a string using VBA | Excel Programming |