Ask a Question related to ASP, Design and Development.
-
J. Muenchbourg #1
Exception occured error
I'm getting an Exception occured error on line 4 (For i =1...)
<% Function ProperCase(strIn)
strOut = ""
boolUp = True
For i = 1 To Len(strIn)
c = Mid(strIn, i, 1)
if c = " " or c = "'" or c = "-" then
strOut = strOut & c
boolUp = True
Else If boolUp Then
tc = Ucase(c)
Else tc = LCase(c)
End If
strOut = strOut & tc
boolUp = False
End If
Next
ProperCase = strOut
End Function %>
this function is put into an include file, and it uppercases a horse's
name's first letter, and lowercases the rest, being called this way:
response.write left(ProperCase(rs1("horsename")),14)
What happens is when there are no more horse's names to be drawn from
the database, that's when I get this Exception occured error
thx for help
Muench
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
J. Muenchbourg Guest
-
Error Occured While Processing Document
I just installed ColdFusion 6.1 today on a Windows 2000 Server running IIS 5.0. I configured it to use IIS as the external server. The installation... -
error occured while processing request
i just want to know what is mean by elemenet LOCALE is undefined in REQUEST ? i try to click to server debug and the result is came out with this... -
An unhandled exception has occured Unknown Server tag
Hi, I am using ASP.Net 2.0 Beta 2. I have a class which inherits from "System.Web.UI.WebControls.Label" class. I have added that class in a... -
Getting the last query when an error occured
HI ! Well, another one ! :) Yes, once again a little question for the newsgroup ! So i begin my explanation : with ESQL/C As all my "C"... -
Exception Occured only on one record
I'm getting an "exception occured" error pointing to this line : <%=Replace(Replace(rs1("racelength"),"D","")," ","") %> ..when all the other... -
Bob Barrows #2
Re: Exception occured error
Add a line to verify that the Len(strIn) > 0
J. Muenchbourg wrote:IF Len(strIn) > 0 then> I'm getting an Exception occured error on line 4 (For i =1...)
>
> <% Function ProperCase(strIn)
> strOut = ""End If> boolUp = True
> For i = 1 To Len(strIn)
> c = Mid(strIn, i, 1)
> if c = " " or c = "'" or c = "-" then
> strOut = strOut & c
> boolUp = True
> Else If boolUp Then
> tc = Ucase(c)
> Else tc = LCase(c)
> End If
> strOut = strOut & tc
> boolUp = False
> End If
> NextBob> ProperCase = strOut
> End Function %>
>
Bob Barrows Guest
-
Aaron Bertrand - MVP #3
Re: Exception occured error
> response.write left(ProperCase(rs1("horsename")),14)
Did you try:
response.write(rs1("horsename"))
Is there a value there?
Maybe you should be testing for EOF!??!? How are you looping through these> What happens is when there are no more horse's names to be drawn from
> the database, that's when I get this Exception occured error
horsenames? Maybe you could show more code, and we could show you how to
fix it...
Aaron Bertrand - MVP Guest
-
Tom B #4
Re: Exception occured error
I'm sure you've had a similar problem before. What happens if the horsename
is null?
If it is null then your line Len(strIn) is asking for the length of a null
string... which is invalid.
You need to test for null first.
Function ProperCase strIn
if isNull(strIn) then Exit Function
OR
Function ProperCase strIn
strIn=strIn & "" 'That'll turn a null into an empty string. But
be careful, an empty string may not work with the rest of your code.
OR
response.write left(ProperCase(rs1("horsename") & ""),14) ' Again, empty
string
"J. Muenchbourg" <anonymous@devdex.com> wrote in message
news:eqQhdIMQDHA.3192@TK2MSFTNGP10.phx.gbl...> I'm getting an Exception occured error on line 4 (For i =1...)
>
> <% Function ProperCase(strIn)
> strOut = ""
> boolUp = True
> For i = 1 To Len(strIn)
> c = Mid(strIn, i, 1)
> if c = " " or c = "'" or c = "-" then
> strOut = strOut & c
> boolUp = True
> Else If boolUp Then
> tc = Ucase(c)
> Else tc = LCase(c)
> End If
> strOut = strOut & tc
> boolUp = False
> End If
> Next
> ProperCase = strOut
> End Function %>
>
> this function is put into an include file, and it uppercases a horse's
> name's first letter, and lowercases the rest, being called this way:
>
> response.write left(ProperCase(rs1("horsename")),14)
>
> What happens is when there are no more horse's names to be drawn from
> the database, that's when I get this Exception occured error
>
> thx for help
> Muench
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Tom B Guest



Reply With Quote

