Click to See Complete Forum and Search --> : SQL


Federica Pavese
August 9th, 1999, 08:31 AM
HI!!
For example, I have this:
sqlwords = "insert into aaaa values('" & txt_name.Text & "'," & Val(txt_number.Text) & ")"
ConectionA.Execute sqlwords

In txt_number.Text I have a number with format. For example: 128.23
But the string named sqlwords, takes this number like 128,23
And the execution fails.
What can I do? Thanks in advance.

Lothar Haensler
August 9th, 1999, 08:36 AM
remove the Val function as in

Dim sqlwords as string
sqlwords = "insert into aaaa values('" & txtName.Text & "'," & txtNumber.Text & ")"
MsgBox sqlwords

kieran_rush
August 9th, 1999, 07:40 PM
Check the regional configuration of your computer, I had the same problem with this I use date and numbers and received errors in return or just a wrong string
Also if you have in SQL a column with the type number and you are sending a string like this '" & text.text & "' you will receive an error use this for the number type columns " & text.text & "

Hope this helps you
Regards

dayananda
August 10th, 1999, 08:12 AM
Use Cdbl instead of using Val function since The val function converts into Numeric value so i suggest you tu use
CDbl where it takes the decimal value in the database

Federica Pavese
August 10th, 1999, 10:11 AM
Thanks to all !
The problem was the Val function and the Format function.