Possible Duplicate:
What is the maximum value for a int32?
Mobileno = Convert.ToInt32(txmobileno.Text);
error i amm getting while inserting in to database
Possible Duplicate:
What is the maximum value for a int32?
Mobileno = Convert.ToInt32(txmobileno.Text);
error i amm getting while inserting in to database
Why on earth would you use an integer of any type to store a phone number?
You can't meaningfully do any arithmetics on one and you lose all leading zeroes.
Use a string instead.
An integer
(Int32) is limited in the values it can store since it "only" uses 32 bits. It can store a value between 2,147,483,647 and -2,147,483,648. (More information on MSDN)
The value represented by the txmobileno.Text
, is too large or too small.
Looking at the name txmobileno
is probably a mobile phone number. This kind of numbers have too much digits to store in an int32
. Also a phone number tends to start with a 0 or 00 or + (international). There's no way of storing this kind of information in an integer (or another number type). Just store them in a string
.
As others have pointed out, storing a phone number as an integer is a mistake.
Having said that, the original question does raise some points which should be made: