Running Microsoft-IIS/5.1 on XP Pro
I'm trying to use Instr and Replace to replace each occurrence of a particular string from a message, like this:
However, I get the following message:
Microsoft VBScript runtime (0x800A0005)
Invalid procedure call or argument: 'Instr'
/forum/formatmessage.asp, line 10
Please help
[Thanks in advance|Hope I helped you]
Exodus300
![[pc3] [pc3] [pc3]](/data/assets/smilies/pc3.gif)
I'm trying to use Instr and Replace to replace each occurrence of a particular string from a message, like this:
Code:
Function FormatMessage(strSource)
Set rs_format = Server.CreateObject("ADODB.RecordSet")
rs_format.Open "SELECT * FROM Smileys", db
Do While Not rs_format.EOF
strSmileyCode = rs_format("SmileyCode")
strFileName = rs_format("FileName")
strAltText = rs_format("Description")
Do While Instr(0, strSource, strSmileyCode, 1) > 0
' Replace the smiley code with the <img> tag
strSource = Replace(strSource, strSmileyCode, "<img src=""images/smileys/""" & strFileName & """ alt=""" & strAltText & """>", , , 1)
Loop
rs_format.MoveNext
Loop
rs_format.Close
Set rs_format = Nothing
' Return the formatted message
FormatMessage = strSource
End Function
However, I get the following message:
Microsoft VBScript runtime (0x800A0005)
Invalid procedure call or argument: 'Instr'
/forum/formatmessage.asp, line 10
Please help
[Thanks in advance|Hope I helped you]
Exodus300
![[pc3] [pc3] [pc3]](/data/assets/smilies/pc3.gif)