Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 25th, 2004, 02:20 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default expected Then

Hi there

I've got a simple If Then statement and my page is throwing up an error; this is my code:


if isNull strShort or strShort = Empty Then response.Write(No Detail currently)

else
                                 replace(strShort, vbcrlf, "<br>"))

end if

and it's giving me this error:

Microsoft VBScript compilation error '800a03f9'

Expected 'Then'

if isNull strShort or strShort = Empty
----------^

I don't know why because I've got Then on the line in question.

Any help greatly appreciated.

Thanks

Adam

Reply With Quote
  #2 (permalink)  
Old November 25th, 2004, 02:33 PM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Adam,

Try this...
Code:
if IsNull(strShort) or strShort = Empty Then                                             
     response.Write("No Detail currently")                      
else
    strShort = replace(strShort, vbcrlf, "<br>")                             
end if
HTH,

Chris

Reply With Quote
  #3 (permalink)  
Old November 25th, 2004, 02:39 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

thanks for your input but it doesn't seem to solve it. The problem is on the line...if IsNull(strShort) or strShort = Empty Then - the error points to this line saying that 'Then' is expected whic dumbfounds me because then is already there

thanks

Adam

Reply With Quote
  #4 (permalink)  
Old November 25th, 2004, 03:07 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
quote:if isNull strShort or strShort = Empty Then
It that you want to check if the strShort variable is empty? or compare with another variable called "Empty" that hold some value in it? If you are looking for the first case, use ISEmpty() function or compare it with "".
Code:
If isempty(strShort) then...

OR

If strShort = "" then

OR

If len(trim(strShort))>0 then
All these should help you on the same cause.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #5 (permalink)  
Old November 25th, 2004, 03:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

sorted, thanks guys

Reply With Quote
  #6 (permalink)  
Old November 25th, 2004, 04:03 PM
Authorized User
 
Join Date: Oct 2004
Location: , , .
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Adam,

This works on my machine:

<%
dim strShort

if ( isNull(strShort) or strShort = Empty ) Then
    response.Write("No Detail currently")

else
    replace strShort, vbcrlf, "<br>"

end if
%>

Happy Thanksgiving,


Reply With Quote
  #7 (permalink)  
Old April 17th, 2008, 05:41 AM
Registered User
Points: 67, Level: 1
Points: 67, Level: 1 Points: 67, Level: 1 Points: 67, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by ChrisScott
 Hi Adam,

Try this...
Code:
if IsNull(strShort) or strShort = Empty Then                                             
     res:([xx(][V]ponse.Write("No Detail currently")                      
else
    strShort = replace(strShort, vbcrlf, "<br>")                             
end if
HTH,

Chris

:(:(:(

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
expected ';' RoniR Javascript 3 February 1st, 2007 05:28 AM
Object Expected!! Apocolypse2005 Javascript 0 July 3rd, 2006 12:23 PM
too few parameters expected n desprate Access VBA 6 April 29th, 2005 06:33 AM
Expected 'Then' Adam H-W Classic ASP Basics 5 July 26th, 2004 02:36 PM



All times are GMT -4. The time now is 12:21 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.