Groups | Blog | Home
all groups > asp.net building controls > april 2006 >

asp.net building controls : converting varchar to double


q
4/20/2006 1:40:14 PM
Double.Parse(txtdocbedrag.Text).ToString( )

(You are taking a string... making it a double... and then trying to
use it as a string. Why?)
Frederik Vanderhaeghe
4/20/2006 4:04:45 PM
Hi,

I try to cast/convert a varchar into a double but it doesn't work, i get an
error that it isn't possible to convert. What can I do?

The code is:
whereSQL += "cast(bedrag as numeric(10,2)) > '" &
Double.Parse(txtdocbedrag.Text) & "' and "

Fré

Richard Troy-Rex
4/20/2006 9:30:22 PM
I don't have experiences on this.
But I have some confused issues.
I remembered it has type 'Double' in T-SQL
I think you should use instance of type 'Double' under .NET to store value
Frederik Vanderhaeghe
4/21/2006 12:00:00 AM
I'm not taking a string, making it double and then using it as a string
again.
In the database there is a field (bedrag) that is from the type varchar.
In my application I have a textbox in which the value is entered as text.
But I have to compare the database field with the textbox field if the value
is greater than, greater than or equal, ...
So I convert the database field to a double and I convert the textfield to a
double and then compare them, but the convert of the database field gives an
error:
Error converting data type varchar to numeric.
What do I have to do?

[quoted text, click to view]

AddThis Social Bookmark Button