decimal point comma regionalization issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mazza
    New Member
    • Jul 2014
    • 1

    decimal point comma regionalization issue

    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:



    Code:
    Private Function CreateData() As SqlDataSource
    
            Dim conn As String = ConfigurationManager.ConnectionStrings("connstrSQS_SQL").ConnectionString
    
            
            Dim EurROECurrency As Double = CDbl(TxEuroROE.Text)
            Dim GBPROECurrency As Double = CDbl(TxGBPROE.Text)
            Dim UserCurrencySettings As String = ""
            Dim LabourCost As Double = CDbl(TxLabour.Text)
    
            Dim LC As Double = CDbl(TxLabour.Text) '10.12D
            Dim SQL As String
    
            ' LabourCost = String.Format(LC.ToString(System.Globalization.CultureInfo.InvariantCulture))
    
    
    
    
            Dim CurrencySetting As String = GetSQSSettingsInfo(Session("CompCode"), "LocalCurrency").ToString
            If CurrencySetting = "DEF" Then
                UserCurrencySettings = GetSQSPriceListInfo(Session("PriceList"), "Currency").ToString()
            Else
                UserCurrencySettings = CurrencySetting
            End If
    
            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"
    
            Return New SqlDataSource(conn, selectCmnd)
    
        End Function
    Last edited by Rabbit; Jul 23 '14, 03:25 PM. Reason: Please use [code] and [/code] tags when posting code or formatted data.
  • iam_clint
    Recognized Expert Top Contributor
    • Jul 2006
    • 1207

    #2
    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.

    Comment

    Working...