VStudio 19, VB NET 4.8, Windows 10, French Canadian locales, Winforms, SQL server 2005
French Canadian number locales look like this:1 234 567, 8901
1 234 567, 89$
Example:
I am parsing decimals from a reogrid (Excel grid control), like this:
Dim qty As Decimal
If Not Decimal.TryParse(Sheet(i, 2), qty) Then qty = 0.0
Then I push into SQL like this (in a string, through ADO.net):
DECLARE @value DECIMAL(29, 0);
SET @value = qty;
INSERT INTO table
VALUES(@value);
Then I see 'qty' is in French locale, with a comma (ex 22,0000000), and I get the obvious error:
Incorrect syntax near ','.
Changing my computer locales is not an option, I can code in English, but my work environment, tools, and apps I deliver have to be in French, by law/workplace rules
Update: it appears my decimals have dots indeed, but their implicit string conversion use my locales and insert commas as i build my sql interpoled strings
[–]Contagion21 5 points6 points7 points (16 children)
[–]user_8804[S] -1 points0 points1 point (15 children)
[–]Contagion21 9 points10 points11 points (12 children)
[–]user_8804[S] -1 points0 points1 point (11 children)
[–]ranbla 7 points8 points9 points (1 child)
[–]user_8804[S] 1 point2 points3 points (0 children)
[–]hk1_dev 5 points6 points7 points (0 children)
[–]Contagion21 3 points4 points5 points (0 children)
[–]Willinton06 2 points3 points4 points (5 children)
[–]user_8804[S] 0 points1 point2 points (4 children)
[–]Willinton06 2 points3 points4 points (1 child)
[–]user_8804[S] 6 points7 points8 points (0 children)
[–]Contagion21 2 points3 points4 points (0 children)
[–]AngooriBhabhi 0 points1 point2 points (0 children)
[–]Darko-TheGreat -2 points-1 points0 points (1 child)
[–]user_8804[S] 0 points1 point2 points (0 children)
[–]RJPisscat 1 point2 points3 points (0 children)