Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help displaying double quotations in a string

Status
Not open for further replies.

justinpl

Programmer
Joined
Nov 20, 2003
Messages
19
Location
US
From some reason when I pull a value out of our access d.b. that has the double quotation mark ("), asp stops processing. Is there a way to display the (") and the rest of the variable...

here is what i have:

...
WHILE NOT RS.EOF

SQLString3 = "SELECT * FROM ExtraValues WHERE TransmissionType ='" & RS("TRAN_TYPE") & "'"

Set RS3 = Con3.Execute(SQLString3)

If RS3.EOF Then %>

<option value="<%=RS("TRAN_TYPE")%>"><%=RS("TRAN_TYPE")%></option>

<% Else %>

<option value="<%=RS("TRAN_TYPE")%>____<%=RS3("ExtraOptions")%>"><%=RS("TRAN_TYPE")%> / <%=(RS3("ExtraOptions")%></option>

<% End If %>

<% RS.MOVENEXT
WEND %>
 
Try this:

<%=Server.HTMLEncode(RS("yourfieldname"))%>

-VJ
 
Because you are using it in an option box:

<option value="fdiojof"dfsoijisdo"> etc

you are breaking out of the code. Try replacing all " with &quot; before displaying, for example use the following

function FormatForHTML(strInput)
strInput = replace(strInput, chr(34), "&quot;")
FormatForHTML = strInput
end function

by the way chr(34) corresponds to "

hope this helps
 
*points @ amorous's post* [thumbsup]

[thumbsup2]DreX
aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top