Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


(Un)escape function and Null Values

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,25790
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> (Un)escape function and Null Values
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 (Un)escape function and Null Values - 9/9/2005 5:06:12 AM   
  cojsteve

 

Posts: 2
Score: 0
Joined: 9/9/2005
Status: offline
I have a script that writes out a bunch of db entries. When these entries are entered into the database, I use the escape function to get rid of unwanted characters and then use the unescape function to write the entry like it was intended to look. My problem is that some of the entries contain blank fields and when I use the escape or unescape funciton on on of these fields it returns the following error: Microsoft VBScript runtime error '800a005e'
Invalid use of Null: 'Unescape' . This means that the blank fields are interpreted as NULL so...I wrote the following function to deal with this.

function fixUnescape(str)
if IsNull(str) then
 fixUnescape = ""
else
 fixUnescape = Unescape(str)
end if
end function

instead of calling Unescape(var), I call fixUnescape(var) and It ought to work...right? Well it doesn't. I actually get the exact same error as before which to me means that it is not catching those blank field entries as NULL in the IsNull if statement. This, of course provides more confusion because the error message suggests that we are dealing with a NULL value.

This one is giving me a huge headache so I would greatly appreciate any help.
 
 
Post #: 1
 
 RE: (Un)escape function and Null Values - 9/10/2005 11:36:15 PM   
  TNO


Posts: 1302
Score: 12
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
Try replacing this:

if IsNull(str) then

with this:

if IsNull(Len(str)) then

_____________________________

To iterate is human, to recurse divine. -- L. Peter Deutsch

(in reply to cojsteve)
 
 
Post #: 2
 
 RE: (Un)escape function and Null Values - 9/12/2005 3:10:54 AM   
  cojsteve

 

Posts: 2
Score: 0
Joined: 9/9/2005
Status: offline
TNO,

Thanks for the help. Unfortunately, I still get the same error. Right now I am just doing it this way: (Un)escape(str & "") which I guess is satisfactory but its one of those things that bothers me to have not solved the problem the right way.

Thanks Again,
Colin

(in reply to cojsteve)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> (Un)escape function and Null Values Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts