Ho una funzione per trasformare il testo con codice HTML in HTML. E le grandi opere in genere, ma per qualche ragione, cerco di usarlo su un testo di oggi, e ottenere il seguente errore:ASP classico: sto ricevendo un errore di mancata corrispondenza di tipo quando non dovrei
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'UnChkString'
/manage/solutions_delete.asp, line 22
La linea che sto usando questa funzione è:
<%= UnChkString(solution_desc) %>
la variabile è solution_desc
:
<p>Here is a description of what this solution is all about.</p>
il campo del database sta tirando il solution_desc
da è un campo di testo.
La mia funzione è UnChkString:
Function UnChkString(string)
UnChkString = Replace(string,"[%]","%")
UnChkString = HTMLDecode(UnChkString)
End Function
La funzione HTMLDecode è:
Function HTMLDecode(sText)
Dim I
sText = Replace(sText, "&" , Chr(38))
sText = Replace(sText, "&" , "&")
sText = Replace(sText, """, Chr(34))
sText = Replace(sText, "’", Chr(39))
sText = Replace(sText, "<" , Chr(60))
sText = Replace(sText, ">" , Chr(62))
sText = Replace(sText, " ", Chr(32))
For I = 1 to 255
sText = Replace(sText, "&#" & I & ";", Chr(I))
Next
HTMLDecode = sText
End Function
EDIT
Ho anche provato:
<%= UnChkString(CStr(solution_desc)) %>
senza fortuna.
Qual è la linea 22? – bfavaretto
@bfavaretto '<% = UnChkString (solution_desc)%>' – James
Forse stai ottenendo 'NULL' dal DB? L'errore si verifica con la stringa di esempio che hai postato? – bfavaretto