Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Building Controls / April 2006

Tip: Looking for answers? Try searching our database.

converting varchar to double

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Frederik Vanderhaeghe - 20 Apr 2006 15:04 GMT
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é
q - 20 Apr 2006 21:40 GMT
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 - 21 Apr 2006 09:29 GMT
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?

> Double.Parse(txtdocbedrag.Text).ToString( )
>
> (You are taking a string... making it a double... and then trying to
> use it as a string.  Why?)
Richard Troy-Rex - 21 Apr 2006 05:30 GMT
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
of type 'Double' under T-SQL but not type 'numeric'.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.