By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,968 Members | 1,852 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,968 IT Pros & Developers. It's quick & easy.

decimal point comma regionalization issue

P: 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
Share this Question
Share on Google+
1 Reply


iam_clint
Expert 100+
P: 1,208
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

Post your reply

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