Trying to generate an error

R

Ray at

Response.Write CInt("x")


Do you have an "On Error Resume Next" in your code?

Ray at work
 
D

DrewM

This is a strange request - but I'm trying to generate a Type Mismatch
error. It's for an example in some documentation.

I was looking for something that would error (like a mathematical equation
using a string) that could be simply fixed using CInt(). However, the
strings are getting converted at run time so I can't get the error to throw!

Any ideas?

Drew
 
D

DrewM

Ray at said:
Response.Write CInt("x")

Do you have an "On Error Resume Next" in your code?

Thanks Ray. There's no OERN in my page - it's just pretty much an empty
document.

I can get the error by doing something like:

Dim myInt, myString
myInt = 3
myString = "three"

if myInt + myString = 6 Then
response.write "match!"
end if

but I really wanted to do it with numbers so i could then show how CInt
solves the problem.

Any thoughts?

Drew
 
R

Ray at

Well CInt won't solve the problem if you're using strings, unless you have
numeric strings.

Dim x, y
x = 1
y = "5"
Response.Write x + y

That will work without the need for cint'ing.

What are you trying to do here?

Ray at work
 
D

DrewM

What are you trying to do here?

Heh - fair question :)

I think endless hours of document writing have fried my brain.
Let me go away and get my thoughts straight.

Thanks for the help.

Drew
 
D

Dan Brussee

Heh - fair question :)

I think endless hours of document writing have fried my brain.
Let me go away and get my thoughts straight.

Thanks for the help.


If you are calling a COM object and do the following:

dim obj, x

set obj = server.createobject("object.thing")
x = 5
obj.SendAnInteger x

This will fail if the parameter in SendAnInteger requries an integer.
This is because all variables in ASP are variants. In this case you
would need to use cint() to satisfy the method interface.
 
P

PB4FUN

Try this :)
<%
Err.Raise 13,"Type Mismatch"
%>

Gets you this :

Technical Information (for support personnel)

Error Type:
Type Mismatch (0x800A000D)
Type mismatch



Meindert, MCP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top