Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 converting textbox value to number

Author  Topic 

alpoor
Starting Member

29 Posts

Posted - 2005-10-13 : 14:49:23
I have a textbox on webform which is always a number and I need to convert this textbox value to number so that I can insert into sqlserver database table. I tried with convert.Int32 but it fails.

Can anybody has any idea

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2005-10-13 : 14:51:20
Well, I like Int32.Parse() myself, but I would expect Convert to work. When you say it fails, what exactly is the Exception type and message that you are getting? Is it the Convert that is failing or is it your use of that value later that is failing?

---------------------------
EmeraldCityDomains.com
Go to Top of Page

alpoor
Starting Member

29 Posts

Posted - 2005-10-13 : 15:01:38


I am getting following error before insert statment where I convert to integer

Value was either too large or too small for an Int32.


following is the code snippet


Dim prnumInt as integer
prnumInt = Int32.parse(ID_PRNum.text)

I am trying to insert this prnumInt into my sqlserver database filed which is defined as number(9)


quote:
Originally posted by alpoor

I have a textbox on webform which is always a number and I need to convert this textbox value to number so that I can insert into sqlserver database table. I tried with convert.Int32 but it fails.

Can anybody has any idea

Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-10-13 : 15:33:49
You said the error was:

>>Value was either too large or too small for an Int32.

Do you know what the range of values is for Int32? Do you think perhaps the value you are trying to convert to an Int32 might be outside of that range? The error message seems pretty clear to me.
Go to Top of Page

jhermiz

3564 Posts

Posted - 2005-10-14 : 08:35:59
Try the following link:

http://www.digioz.com/datatypes.php


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]
Imperfection living for perfection --
[url]http://jhermiz.blogspot.com/[/url]
Go to Top of Page
   

- Advertisement -