Recordset value starting with "<" (less than sign) wont display

J

J.D. Buehls

I am displaying some values on a report. I am opening the .asp page
with a
Response.ContentType = "application/msword" and these particular
values appear in a table. One column shows percentages such as "5",
"95", "50", or "<5" There is no "%" character stored in the database
just the number (and the "<" sign if there is one).

Problem is NONE of the "<5" values appear in my report table. Does
this have something to do with "<" being an html character. The field
type is just a size 3 nvarchar. Relevant code below:

strSQL2 = "SELECT * FROM jambue.SUMMARY WHERE POSCODE = '" & id & "'
AND IDCODE1 ='" & dept & "' AND IDCODE2 ='" & unit & "'"
Set rstDBEdit2 = Server.CreateObject("ADODB.Recordset")
rstDBEdit2.Open strSQL2, CONN_STRING, adOpenKeyset, adLockOptimistic,
adCmdText

<font face="Courier New" size="-1"><%=
rstDBEdit2.Fields("H_STAP").Value %> %</font>
 
M

Manohar Kamath [MVP]

Use Server.HTMLEncode() if you want to display all symbols on the screen,
rather than use the exact text in your HTML. Otherwise, symbols like < will
get mixed with the other HTML content on your page and ahcnage the display.

E.g.

<%= Server.HTMLEncode(rstDBEdit2.Fields("H_STAP").Value) %>

The HTMLEncode method replaces certain symbols with the HTML equivalents. <
will be represented by &lt;
 
J

J.D. Buehls

Thanks for the reply!

I tried using the HTMLEncode method before making my first post. I had
thought about that having used the method before. However when I use
that on all my fields I still just get a blank. I checked uner VIEW -
HTML SOURCE inside WORD and this is in the spot where my recordset value
should be:

<td style='padding:0in 0in 0in 0in'>
<p class=MsoNormal align=center style='text-align:center'>
<![if !supportEmptyParas]>&nbsp;<![endif]>
<span style='font-size:10.0pt'><o:p></o:p></span></p>
</td>
<5 %>


This is what is looks like for another percentage (100%)

<td style='padding:0in 0in 0in 0in'>
<p class=MsoNormal align=center style='text-align:center'><span
style='font-size:7.5pt;font-family:"Courier New"'>100 %</span><span
style='font-size:10.0pt'><o:p></o:p></span></p>
</td>


So it is getting screwed up somehow.

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top