473,788 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting text to double

Hi,

I have a problem converting text to a double. Why doesn't the code work:
If Not (txtdocbedrag.T ext = "") Then

Select Case ddlBedrag.Selec tedIndex

Case 0

Case 1

whereSQL += "cast(bedra g as numeric(10,2)) > '" &
Double.Parse(tx tdocbedrag.Text ) & "' and "

Case 2

whereSQL += "cast(bedra g as numeric(10,2)) >= '" &
Double.Parse(tx tdocbedrag.Text ) & "' and "

Case 3

whereSQL += "cast(bedra g as numeric(10,2)) < '" &
Double.Parse(tx tdocbedrag.Text ) & "' and "

Case 4

whereSQL += "cast(bedra g as numeric(10,2)) <= '" &
Double.Parse(tx tdocbedrag.Text ) & "' and "

Case 5

whereSQL += "cast(bedra g as numeric(10,2)) = '" &
Double.Parse(tx tdocbedrag.Text ) & "' and "

Case 6

whereSQL += "cast(bedra g as numeric(10,2)) >= '" &
Double.Parse(tx tdocbedrag.Text ) & "' cast(bedrag as numeric(10,2)) < '" &
Double.Parse(tx tBedragTot.Text ) & "' and "

End Select

End If
Apr 18 '06
12 3193
then don't do that (?)

Obviously double.parse is failing. Catch the exception, and debug the
results.

Response.write, instead of issuing the sql (duh)

txtdocbedrag.te xt contains text you don't expect. Find out why

I find it amazing, and almost sad, the programmers these days can't figure
out reproducible problems.

I'm 50. I had issues like this 25 years ago, but before newgroups, granted.

Just my opinion

"Frederik Vanderhaeghe" <fr************ ******@gmail.co m> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
whereSQL += "cast(bedra g as numeric(10,2)) > '" &
Double.Parse(tx tdocbedrag.Text ) & "' and "


Bedrag = varchar with a

"Jeff Dillon" <je********@hot mail.com> wrote in message
news:OW******** ******@TK2MSFTN GP03.phx.gbl...
Post the exact line, and the value of all variables, that is generating
the error. You can use CDbl too

Apr 20 '06 #11
It's not the double.parse that is failing, its the convert in sql!

"Jeff Dillon" <je********@hot mail.com> wrote in message
news:uq******** ******@TK2MSFTN GP03.phx.gbl...
then don't do that (?)

Obviously double.parse is failing. Catch the exception, and debug the
results.

Response.write, instead of issuing the sql (duh)

txtdocbedrag.te xt contains text you don't expect. Find out why

I find it amazing, and almost sad, the programmers these days can't figure
out reproducible problems.

I'm 50. I had issues like this 25 years ago, but before newgroups,
granted.

Just my opinion

"Frederik Vanderhaeghe" <fr************ ******@gmail.co m> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
whereSQL += "cast(bedra g as numeric(10,2)) > '" &
Double.Parse(tx tdocbedrag.Text ) & "' and "


Bedrag = varchar with a

"Jeff Dillon" <je********@hot mail.com> wrote in message
news:OW******** ******@TK2MSFTN GP03.phx.gbl...
Post the exact line, and the value of all variables, that is generating
the error. You can use CDbl too


Apr 21 '06 #12
Please show the resultant SQL

response.write strSQL

but don't actually execute it.

Jeff

"Frederik Vanderhaeghe" <fr************ ******@gmail.co m> wrote in message
news:Of******** ******@TK2MSFTN GP02.phx.gbl...
It's not the double.parse that is failing, its the convert in sql!

"Jeff Dillon" <je********@hot mail.com> wrote in message
news:uq******** ******@TK2MSFTN GP03.phx.gbl...
then don't do that (?)

Obviously double.parse is failing. Catch the exception, and debug the
results.

Response.write, instead of issuing the sql (duh)

txtdocbedrag.te xt contains text you don't expect. Find out why

I find it amazing, and almost sad, the programmers these days can't
figure out reproducible problems.

I'm 50. I had issues like this 25 years ago, but before newgroups,
granted.

Just my opinion

"Frederik Vanderhaeghe" <fr************ ******@gmail.co m> wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
whereSQL += "cast(bedra g as numeric(10,2)) > '" &
Double.Parse(tx tdocbedrag.Text ) & "' and "

Bedrag = varchar with a

"Jeff Dillon" <je********@hot mail.com> wrote in message
news:OW******** ******@TK2MSFTN GP03.phx.gbl...
Post the exact line, and the value of all variables, that is generating
the error. You can use CDbl too



Apr 21 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
11962
by: shang | last post by:
Hi! I am trying to find a function that converts a string into a double or a long double number. I found atod() but I don't know which library I have to include to use it. Could someone help me? Thanks!
1
11663
by: Kent Lewandowski | last post by:
Hi, I saw this post from 3 years ago regarding converting DOUBLE values to CHAR in ibm DB2. Now I'm having the same problem. No real solution was posted to that old thread. Has anyone got more information how I avoid the scientific notation when I use the CHAR() function to convert a DOUBLE or FLOAT ? What I want is "MagicFunction" in the following pseudocode: myVarchar = MagicFunction(123.0003);
8
4475
by: Scott | last post by:
How do I convert the contents of a textbox to a double for mathmateical operations? I'm using a form to collect values and when the user clicks OK, the vlaues are used for calcualtions... but they need to be double data type. Then, after the calculations, how to do I convert the double back into the data type needed by the textbox control? Thanks, Scott
7
2710
by: Tor Aadnevik | last post by:
Hi, I have a problem converting values from Single to double. eg. When the Single value 12.19 is converted to double, the result is 12.1899995803833. Anyone know how to avoid this? Regards Totto
116
35999
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused problems elsewhere in another part of the system where that figure was used for some calculation and some eventual truncation led to the system going haywire. So my question is, given this code: int main() { float f = 59.89F;
10
1998
by: Ron | last post by:
I want to calculate the surface area of a sphere from an inputed radius with option strict on. I guess I am not converting something correctly. Here is what I am doing: I have a textbox txtradius that I enter a radius into. I then have a lable that I want the surface area to be displayed in called lblsurface
3
4029
by: RG | last post by:
I am reading in from a serial port a 16 bit number from 0 to 65536. It is being read as a string from my microcontroller into VB using DEC5 or 5 digits are displayed. I need to display this value live as a decimal number so I can manipulate the value. For instance I have the following line: TextBox2.Text = buffer1 - 32768 but this generates an error after a few iterations because buffer1 is
25
4394
by: Blasting Cap | last post by:
I keep getting errors that pop up when I am trying to convert an application from dotnet framework 1.1 to framework 2.0. The old project was saved in sourcesafe from Visual Studio 2003, and I have opened it in Visual Studio 2005. I've cleared up most errors, but have one that beats the heck out of me. I have a page: sales/Item.aspx that has several datagrids in it.
3
2502
by: sparks | last post by:
After changing all the variables in a table from long to double. you get 9.1====becomes==== 9.19999980926514 ok I checked microsoft and they had a workaround. export the values to excel...then import them back into the new table. well I tried that and get the same thing. is there a work around for the work around LOL
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10364
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.