Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: int type and .5 from form


Message #1 by dont worry <aspmailbox@y...> on Tue, 19 Mar 2002 20:02:27 -0800 (PST)
sql server database field set to int for numbers. 
when user enters .5 into form isNumeric is true and
insert, but I get the cannot covert data type varchar
to int.  .5 is a number, its half of 1? whats the
problem here?
DW

__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 20 Mar 2002 18:21:07 +1100
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "dont worry" <aspmailbox@y...>
Subject: [asp_databases] int type and .5 from form


: sql server database field set to int for numbers.
: when user enters .5 into form isNumeric is true and
: insert, but I get the cannot covert data type varchar
: to int.  .5 is a number, its half of 1? whats the
: problem here?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

0.5 is not an integer. Integers are whole numbers.
You need to use a different type of field if you want to store fractional
numbers.

Cheers
Ken

Message #3 by dont worry <aspmailbox@y...> on Wed, 20 Mar 2002 10:12:31 -0800 (PST)
So its Numeric, thus passing the isNumeric function,
but it is not an Interger, thus failing the insert. 
Should I use decimal?

--- Ken Schaefer <ken@a...> wrote:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> From: "dont worry" <aspmailbox@y...>
> Subject: [asp_databases] int type and .5 from form
> 
> 
> : sql server database field set to int for numbers.
> : when user enters .5 into form isNumeric is true
> and
> : insert, but I get the cannot covert data type
> varchar
> : to int.  .5 is a number, its half of 1? whats the
> : problem here?
> 
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 
> 0.5 is not an integer. Integers are whole numbers.
> You need to use a different type of field if you
> want to store fractional
> numbers.
> 
> Cheers
> Ken
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/
Message #4 by "Ken Schaefer" <ken@a...> on Thu, 21 Mar 2002 16:01:37 +1100
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "dont worry" <aspmailbox@y...>
Subject: [asp_databases] Re: int type and .5 from form


: So its Numeric, thus passing the isNumeric function,
: but it is not an Interger, thus failing the insert.
: Should I use decimal?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Look in SQL Server Books Online and select the datatype that you think is
most appropriate for the data that you plan to store in the field...

Cheers
Ken


  Return to Index