Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CINT problem

Status
Not open for further replies.

spicysudhi

Programmer
Nov 10, 2003
575
FR
Hi,

suddenly i am facing a new error in the perfectly working website.

It throws "Type Mismatch" error in the following statement.

lstext = ""
response.write cint(lstext)

It was working fine and now giving error. Why and how to resolve this? Most of the cases the lstext is assigned with some numbers. When it is blank, I get this error.

thanks

regards,
Sudhi
 
I don't know... has it not always been a type mismatch error? The simplest fix would be to test isnumeric().
[tt]
lstext = ""
if isnumeric(lstext) then
response.write cint(lstext) & "<br />"
else
response.write "non-numeric: " & lstext & "<br />"
end if
[/tt]
(note: if it's numeric, recall that it gives banker's round to lstext.)

Also if the application takes whitespaces semantically equivalent to 0, you could add this before starting the cint() business.
[tt] if trim(lstext)="" then lstext=0
[/tt]
 
yeah, thanks. For now i am putting the fix. But it was always working fine. Suddenly this error, wondering why!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top