Print Page | Close Window

Invalid use of Null

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=29290
Printed Date: 28 March 2026 at 3:12pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Invalid use of Null
Posted By: fabrixnet
Subject: Invalid use of Null
Date Posted: 04 May 2011 at 11:08pm
hello,
I have this function that is OK in my old server:

Function DisattivaHTML(sTestoDH)
    If Len(sTestoDH)>0 Then
        sTestoDH = Replace(sTestoDH, "&lt;", "<", 1, -1, 1)
    End If
    DisattivaHTML=sTestoDH
End Function


But in
webwiz server it gives this error:

Microsoft VBScript runtime error '800a005e'

Invalid use of Null: 'Replace'

As I can fix it?




Replies:
Posted By: WebWiz-Bruce
Date Posted: 05 May 2011 at 7:32am
Looks like you are passing a Null database value to the fuction try this:-


Function DisattivaHTML(sTestoDH)
    If Len(sTestoDH)>0 AND isNull(
sTestoDH) = False Then
        sTestoDH = Replace(sTestoDH, "&lt;", "<", 1, -1, 1)
    End If
    DisattivaHTML=sTestoDH
End Function




-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting


Posted By: fabrixnet
Date Posted: 05 May 2011 at 9:33am
ok, it is perfect.
 Thanks!


Posted By: yandr
Date Posted: 05 May 2011 at 2:11pm
Shouldn't it be
If isNull(sTestoDH) = False AND Len(sTestoDH)>0 Then
or
If Not(isNull(sTestoDH)) AND Len(sTestoDH)>0 Then

?


Posted By: WebWiz-Bruce
Date Posted: 05 May 2011 at 2:34pm
Each of the methods would work fine, except the last one which should be:-

If NOT isNull(sTestoDH) AND Len(sTestoDH)>0 Then



-------------
https://www.webwiz.net/web-wiz-forums/forum-hosting.htm" rel="nofollow - Web Wiz Forums Hosting
https://www.webwiz.net/web-hosting/windows-web-hosting.htm" rel="nofollow - ASP.NET Web Hosting



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net