473,320 Members | 2,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
3 3220
Add a line to verify that the Len(strIn) > 0
J. Muenchbourg wrote:
I'm getting an Exception occured error on line 4 (For i =1...)

<% Function ProperCase(strIn)
strOut = "" IF Len(strIn) > 0 then 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 End If ProperCase = strOut
End Function %>

Bob
Jul 19 '05 #2
> response.write left(ProperCase(rs1("horsename")),14)

Did you try:

response.write(rs1("horsename"))

Is there a value there?
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


Maybe you should be testing for EOF!??!? How are you looping through these
horsenames? Maybe you could show more code, and we could show you how to
fix it...
Jul 19 '05 #3
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" <an*******@devdex.com> wrote in message
news:eq**************@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 http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: David | last post by:
Hi, Ive been trying to work this out for the past 2 days now and im not getting anywhere fast. The problem i have is that i am using Asynchronous sockets to create a Socket Client library....
6
by: Vadivel Kumar | last post by:
I've a problem in handling a custom exception The following is my custom exception class: public class AppException : public Exception { public AppException (string message, Exception...
3
by: bobueland | last post by:
Sometimes the best way to understand something is to understand the mechanism behind it. Maybe that is true for exceptions. This is a model I have right now (which probably is wrong) 1. When a...
3
by: c676228 | last post by:
Hi everyone, I have a piece of code in sales.aspx.vb like this: Protected WithEvents Message As System.Web.UI.WebControls.Label Try ... ChartImage.ImageUrl = "ChartGenerator.aspx?" + DataStr +...
132
by: Zorro | last post by:
The simplicity of stack unraveling of C++ is not without defective consequences. The following article points to C++ examples showing the defects. An engineer aware of defects can avoid...
9
by: Frawls | last post by:
Hi I Am am having problems with a stored Procedure that i wrote. Basically whats happening is that the Stored procedure Runs fine when i EXECUTE it in SQL Query analyzer. But when i debug...
2
by: Hetal | last post by:
I searched online and went through the forums as well, but i could not find a way to capture the database primary key violation exception. Any help will be much appreciated. Thanks, Hetal
0
by: Gary | last post by:
Trying to install VB6 (learning edition) on Windows XP. When running the SETUP.EXE to install Visual Basic 6.0 it gives the error... "An unhandled win32 exception occured in vs60wiz.exe" or...
0
by: srizzler | last post by:
Hi All: I am trying to implement Exception Handling using Enterprise Library 3.1's Exception Handling Application Block as well as Logging Blocks. I have a windows application developed in...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.