Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Saving text with apostrophes
Message
Information générale
Forum:
Internet
Catégorie:
Active Server Page
Divers
Thread ID:
00467048
Message ID:
00467078
Vues:
11
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform