Question : Data truncated MYSQL

Hi!

Have made a application in vb.net that are using MYSQL.

One of my forms are using a Double field, that are price-field.

In my Mysql table the field are declared as:

Nypris   -   Double     - Sice (12,2)

When the field have a round number example : 100,0    
When i execute my included query, everything is working fine.

But if the Nypirs is Example 100,80  
Give me Data truncated error...

I have tryed to change my field in database to numeric.
But dosent help ?

What is wrong ?



1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
sSQL = "INSERT INTO " & tblordrelinje & " (OrdreID,Delenummer,Antall,Rabatt,Nybeskrivelse,Nypris,Levert,Vekt,Dato) VALUES('" & OrdreID.Text & _
        "','" & varenr.Text & _
        "','" & ant.Text & _
        "','" & rabatten & _
        "','" & beskrivelse.Text & _
        "','" & Cdbl(Nypris.Text) & _                     --> THIS GIVE Data Truncated
        "','" & 0 & _
        "','" & vekt.Text & _
        "','" & Date.Now & "')"

nl_dbconn.Execute(strSQL)

Answer : Data truncated MYSQL

If to remove the quotes did not help, there is something that seems odd on your post.
You are referring to the double values using a comma: 100,00 100.80
I know that you have a CDbl that should convert the typed text to double, but maybe what you are facing is some problem with the decimal representation. Maybe your machine is using comma for decimal separator, but the database is expecting a period. Try to execute your query inputing a double value with a period instead of a comma as decimal separator: 100.80

Regards,
Walter.
Random Solutions  
 
programming4us programming4us