 |
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
|
|
|

November 25th, 2004, 02:20 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

November 25th, 2004, 02:33 PM
|
Friend of Wrox
|
|
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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
|

November 25th, 2004, 02:39 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
|

November 25th, 2004, 03:07 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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
|

November 25th, 2004, 03:59 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 347
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
sorted, thanks guys
|

November 25th, 2004, 04:03 PM
|
Authorized User
|
|
Join Date: Oct 2004
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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,
|

April 17th, 2008, 05:41 AM
|
Registered User
|
|
Join Date: Sep 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
 
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
|
 :(:(:(
|
|
 |