473,395 Members | 2,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

decimal point comma regionalization issue

1
I try to update a gridview datasource when the Databind occurs. I have 3 textboxes where I have a value (labour, Rate of exchange Euro, Rate of Exchange GBP)
in the SQL selectstatement I use these.
All works fine for UK/US settings of the browser, as soon as I have for example a German setting I believe the decimal point and the decimal comma is causing me problems to no end. Tried various options but seems to loose the battle here.
where i mulitply my sitetime with labourcost for example i get incorrect results.

Can somebody point me in the right direction here?

code is as follows:



Expand|Select|Wrap|Line Numbers
  1. Private Function CreateData() As SqlDataSource
  2.  
  3.         Dim conn As String = ConfigurationManager.ConnectionStrings("connstrSQS_SQL").ConnectionString
  4.  
  5.  
  6.         Dim EurROECurrency As Double = CDbl(TxEuroROE.Text)
  7.         Dim GBPROECurrency As Double = CDbl(TxGBPROE.Text)
  8.         Dim UserCurrencySettings As String = ""
  9.         Dim LabourCost As Double = CDbl(TxLabour.Text)
  10.  
  11.         Dim LC As Double = CDbl(TxLabour.Text) '10.12D
  12.         Dim SQL As String
  13.  
  14.         ' LabourCost = String.Format(LC.ToString(System.Globalization.CultureInfo.InvariantCulture))
  15.  
  16.  
  17.  
  18.  
  19.         Dim CurrencySetting As String = GetSQSSettingsInfo(Session("CompCode"), "LocalCurrency").ToString
  20.         If CurrencySetting = "DEF" Then
  21.             UserCurrencySettings = GetSQSPriceListInfo(Session("PriceList"), "Currency").ToString()
  22.         Else
  23.             UserCurrencySettings = CurrencySetting
  24.         End If
  25.  
  26.         Dim selectCmnd As String = "SELECT TblWebServiceSchedule.HRS, TblRtParts.DispRef, TblRtParts.Description, TblWebServiceSchedule.Quantity, TblRtParts.SellPrice * TblWebServiceSchedule.Quantity AS Price, TblWebServiceSchedule.SiteTime, TblWebServiceSchedule.SiteTime * " & LabourCost & " AS Labour[/u][/u], CASE WHEN [Currency SellPrice] = 'EUR' THEN (TblRtParts.SellPrice * " & EurROECurrency & " * TblWebServiceSchedule.Quantity) ELSE (TblRtParts.SellPrice * " & GBPROECurrency & " * TblWebServiceSchedule.Quantity) END AS LocalPrice, '" & UserCurrencySettings & "' AS userCurrency FROM TblWebServiceSchedule INNER JOIN TblRtParts ON TblWebServiceSchedule.PartNoCode = TblRtParts.Ref WHERE (TblWebServiceSchedule.Oil LIKE '%" & ddlOil.Value & "%' OR TblWebServiceSchedule.Oil IS NULL) AND (TblWebServiceSchedule.ModelId LIKE '%" & ddlModel.Value & "%') AND (TblRtParts.LangRef LIKE '%" & ddlPriceList.Value & "%') ORDER BY TblWebServiceSchedule.HRS, TblWebServiceSchedule.PartCode"
  27.  
  28.         Return New SqlDataSource(conn, selectCmnd)
  29.  
  30.     End Function
Jul 23 '14 #1
1 1163
iam_clint
1,208 Expert 1GB
Well there is a difference in programming between a . and a ,
If the input is going to be a decimal point you need to replace it with a ., this is fairly easy to do since you are working with a string to begin with.
Oct 5 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Bror Johansson | last post by:
Is there a way to 'configure' the built-in conversion function float() to accept '.' (dot) as decimalpartdelimiter when executing in an anglo-american-language environment and to accept ',' (comma)...
3
by: Kim Bundgaard | last post by:
Hi Any suggestion would be fine. I have installed DB2 Connect EE V8.1 (fixpak 4) at two different Windows 2000 Servers, both have the same regional settings. I am connecting to the same DB2...
5
by: RichW | last post by:
Hi, I'm writing a program that has got a bit of maths in it. I perform a division and then end up with something like 2.50, or 3.87, or 4.9975 (ie. y.12345). I need to get rid of anything in...
3
by: Rasool | last post by:
A numeric field is shown differently on the Test and Production env. For example 3.5 is shown as 3,5. Originally we thought this has something to do with Regional Option, however both server have...
18
by: Kuljit | last post by:
I am doing Engineering(B.Tech) in Computer Science. I have a question for which i am struggling to write a C code(program). It struck me when we were being taught about a program which counts the...
5
by: trawlerman | last post by:
Hi all, C# newbie after migrating from VB. I wish to have only valid numbers entered into a txtbox . i.e only one decimal point. ///////////////////My VB code for this is: Private Sub...
7
by: Stefantastisk | last post by:
Hey there, Anyone knows a clever method for knowing the length of the digit after a decimal point in a standard C# decimal value, WITHOUT use of any string formatting. Example: 5231,12231 <-...
3
by: Hector | last post by:
Hi, My application supports different languages, and i have a problem with the decimals: In this application, i receive datas like "10.528". When i use CurrentCulture = "en-US", no problem....
2
by: KiP.Kolodziejczyk | last post by:
I 'd like to insert (via "bulk insert") between 10-20 files (about 300MB each) into one table. The problem is that in input files decimal point is written as "," and without leading zeros (i.e.:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.