Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Invalid use of Null
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Invalid use of Null

 Post Reply Post Reply
Author
 Rating: Topic Rating: 1 Votes, Average 5.00  Topic Search Topic Search  Topic Options Topic Options
fabrixnet View Drop Down
Groupie
Groupie
Avatar

Joined: 19 June 2002
Location: Italy
Status: Offline
Points: 89
Post Options Post Options   Thanks (0) Thanks(0)   Quote fabrixnet Quote  Post ReplyReply Direct Link To This Post Topic: Invalid use of Null
    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?

Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Answer Answer
Post Options Post Options   Thanks (1) Thanks(1)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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




Edited by WebWiz-Bruce - 05 May 2011 at 9:48am
Back to Top
fabrixnet View Drop Down
Groupie
Groupie
Avatar

Joined: 19 June 2002
Location: Italy
Status: Offline
Points: 89
Post Options Post Options   Thanks (0) Thanks(0)   Quote fabrixnet Quote  Post ReplyReply Direct Link To This Post Posted: 05 May 2011 at 9:33am
ok, it is perfect.
 Thanks!
Back to Top
yandr View Drop Down
Groupie
Groupie


Joined: 10 March 2009
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote yandr Quote  Post ReplyReply Direct Link To This Post 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

?
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.