A More Convenient cInt
page 1 of 2
Published: 07 Oct 2003
Unedited - Community Contributed
The cInt function raises an exception when passed a null value, blank string, or non-numerical string. You can adapt the function to cInt2 to handle these values and use it in the same manner.
by Dan Powderhill
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 16045/ 33
Article Contents:

When you work with forms and databases a lot you will often want to save the numerical value of a form element, in particular a group of radio buttons, to a database. In general this is easy, however if the field is not mandatory and the user chooses not to answer then the value which gets passed is null, or a blank string. If you pass the cInt function a null value, blank string, or non-numerical string it raises an exception.

Whilst that in itself isn’t a problem as you can write a routine to check the value before using cInt and make sure it is a valid number, it is easier simply to adapt the cInt function to handle them.

View Entire Article

User Comments

Title: Great stuff!!   
Name: Peter
Date: 2008-11-11 7:42:05 AM
Thanks so much - saved me time (that I dont have) in resolving this issue!! Beautiful.

Product Spotlight
Product Spotlight 

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-06-18 6:02:09 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search