decimal values with no separators... RRS feed

  • Question

  • User-81382370 posted



    I try to add decimal values to a access db, but it is inserted without any separator. Here's how I do it...

    Private Sub add()

    Dim TimeItTook As Double = (Convert.ToDouble(DirectCast(RadComboBox1.SelectedItem, BL.TimeHandler).TimeName, New Globalization.CultureInfo("sv-SE", False)))
    End Sub
    Private Sub AddJob(ByVal t As Double)
            Dim MySQL As String = "INSERT INTO tbl_Work (TimeItTook) " & _
            "Values (@WorkTime)"
            Dim MyConn As New OleDbConnection(MyProviderString)
            Dim Cmd As New OleDbCommand(MySQL, MyConn)
            Dim DeciamlParameter As New OleDbParameter("WorkTime", OleDbType.Decimal)
            DeciamlParameter.Value = t
            DeciamlParameter.Precision = 9
            DeciamlParameter.Scale = 2
            With Cmd.Parameters
            End With
    End Sub

    Why is this not working?

    Friday, May 14, 2010 6:21 AM


  • User-25924017 posted

    It can be caused by cultural setting mismatch, whats the regional and culture setting on your machine chekc in control panel specilly for decimal seperator?  in Swiden its "," for decimal seperator am I right?

    also you can try changing the decimal type to currency type in database and in code.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, May 15, 2010 3:26 PM