problem with float numbers
#1

hello, i am updating db but it doesnt update correctly.

 

i have a datagridview where i get values from db.

 

2

 

when i try to update it to db, in db only appears the int part of the number in the col Probability.

 

i use this record to update:

 

 

record = "INSERT INTO t_moonstone_reward (a_type, a_index, a_giftindex, a_giftcount, a_giftprob, a_giftflag) VALUES ( 2545, " + dataGridView1[0, i].Value + ", " + dataGridView1[1, i].Value + ", " + dataGridView1[2, i].Value + ", " + dataGridView1[3, i].Value + ", " + dataGridView1[4, i].Value + " ) ON DUPLICATE KEY UPDATE a_index = " + dataGridView1[0, i].Value + ", a_giftindex = " + dataGridView1[1, i].Value + ", a_giftcount = " + dataGridView1[2, i].Value + ", a_giftprob = " + Convert.ToDecimal(dataGridView1[3, i].Value) + ", a_giftflag = " + dataGridView1[4, i].Value + " ;";

 

and when i run this sentence, update well but field a_giftprob updates bad because it only updates int part of the number (in this case number is 0,5 and only appears 0).

 

could anyone help me?

 

thanks in advance.



Messages In This Thread
[No subject] - by soryjero - 08-08-2013, 11:45 AM
[No subject] - by someone - 08-08-2013, 05:28 PM
[No subject] - by soryjero - 08-08-2013, 09:35 PM
[No subject] - by HateMe - 08-09-2013, 09:16 AM
[No subject] - by soryjero - 08-09-2013, 09:32 AM
[No subject] - by soryjero - 08-09-2013, 09:48 AM

Forum Jump:


Users browsing this thread: 2 Guest(s)