Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SELECT * FROM and the apostrophe
Message
 
To
15/10/1999 09:33:58
General information
Forum:
Visual Basic
Category:
VBScript
Miscellaneous
Thread ID:
00276634
Message ID:
00276869
Views:
30
>Eric this is what I did and the error I got,
>
>C_BusinessName="Bob's Funny Farm"
>sqlQuery2 = "SELECT * FROM CustomerInfo WHERE BusinessName='"&C_BusinessName&"'"
>set objRec2 = Server.CreateObject("ADODB.Recordset")
>objRec2.open sqlQuery2, objCmd, adOpenKeyset, adLockOptimistic, adCmdText
>
>and upon load the ASP page I got the next error:
>
>Microsoft OLE DB Provider for SQL Server error '80040e14'
>Line 1: Incorrect syntax near 's'.
>/sgtest.asp, line 15

Try this:
C_BusinessName=replace("Bob's Funny Farm", "'", "''")
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Reply
Map
View

Click here to load this message in the networking platform