Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving text with apostrophes
Message
General information
Forum:
Internet
Category:
Active Server Page
Miscellaneous
Thread ID:
00467048
Message ID:
00467078
Views:
12
>How do I programmatically save text with apostrophes in MSSQL text-field?
>
>For example:
>
>Set dbLogin = Server.createobject("ADODB.Connection")
>dbLogin.Open Session("gDB_ConnectionString")
>
>strText = "Here's your feedback"
>
>strSQL = "INSERT INTO Feedback "
>strSQL = strSQL & "(message, enteredby) VALUES "
>strSQL = strSQL & "('" & Request.Form("txtMessage") & "', "
>strSQL = strSQL & "'" & Trim(CStr(Request.Form("txtEnteredBy")))
>strSQL = strSQL & " at " & Session("Username") & "')"
>
>dbLogin.Execute(strSQL)

You have to double the quotes. In VB, we have Replace. Does it exist in VBScript?

It is use like this: Replace(StringValue, "'", "''")
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform