Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 25th, 2004, 02:20 PM
Friend of Wrox
 
Join Date: Jun 2003
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

 
Old November 25th, 2004, 02:33 PM
Friend of Wrox
 
Join Date: Jul 2003
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

 
Old November 25th, 2004, 02:39 PM
Friend of Wrox
 
Join Date: Jun 2003
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

 
Old November 25th, 2004, 03:07 PM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old November 25th, 2004, 03:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Adam H-W
Default

sorted, thanks guys

 
Old November 25th, 2004, 04:03 PM
Authorized User
 
Join Date: Oct 2004
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,


 
Old April 17th, 2008, 05:41 AM
Registered User
 
Join Date: Sep 2006
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

:(:(:(






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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.