Double decimal sign

IxiRancid

Well-known member
Joined
Jun 16, 2004
Messages
104
Location
Europe
I ran into a nasty problem, perhaps someone can help me:
Im inserting/updating some data into database. Some of the fields are Double type. Now, when I do this:
Code:
 Dim strUPDATE As String
        strUPDATE = "UPDATE tblPostavke SET " & _
        "IDpodjetja = " & s_podjetje & ", " & _
        "zunanjast = " & s_zunanjast & ", " & _
        "datumvnosa = " & s_datumvnosa & ", " & _
        "datumopravljene = " & s_datumopravljene & ", " & _
        "datumzapadlosti = " & s_datumzapadlosti & ", " & _
        "znesekSIT = " & s_znesekSIT & ", " & _
        "znesekEUR = " & s_znesekEUR & _
        " WHERE IDfaktura = 21"
Some values (got from s_znesekEUR = txtZnsesek.Text - s_znesekEUR = Double) get this value 123,45. Its because of my local settings in WinXP. Can I somehow change this decimal sign into a dot (.)? Because the UPADTE clearely doesnt work, its like there is an additional value after the comma.

Hope its clear enough and thanks!
 
Last edited by a moderator:
If you use either a stored procedure or a parameterised query then this wouldnt be an issue.
String concatenation and SQL statements are always error prone, subject to odd issues like localisation and a potential security risk.
 
Standard answer...
Use Parameters instead of parsing a string. Safer and more robust

HTH
/Kejpa
 
Thanks to both, but those Parameters are really time consuming (I write my code by hand so I dont use DataAdapters and Designer stuff), however this probably will be the solution.
I got something to work with RegEx, but it took a lot of time, I think this will be as it is, and the next pages will use Parameters.
 
The big question is though how much more time consuming is it to do data access with parameters in the first place compared to the time and effort taken to debug your string concatenation based code.
Plus the time taken to handle all the special cases that only crop up at runtime. Plus invalid input / data types. Plus security implications.

In the end did you save anytime by having to resort to RegEx to make this work...
 
IxiRancid said:
Thanks to both, but those Parameters are really time consuming (I write my code by hand so I dont use DataAdapters and Designer stuff), however this probably will be the solution.
I got something to work with RegEx, but it took a lot of time, I think this will be as it is, and the next pages will use Parameters.
With intellisense and code completion, parameters are trivial. And as PD mentioned . . .

I know exactly how much time it costs to code with parameters.
I have no idea what a bug will cost, time - money - customers.

Nip it in the bud!
 
Back
Top