mercredi 6 mai 2015

ERR conversion from string to type 'double' is not valid. vb.net

i have a label name annual it display number from table in the database , this number is displayed like this 27.9828272 .i want just the 2 decimals . i tried

If FrmLogin.CBformState.Text = "User" Then

            com1.CommandText = "select * from balance where UserID = '" & FrmLogin.txtUserName.Text & "'"

            com1.Connection = cn1

            dr2 = com1.ExecuteReader

            If dr2.Read Then
                Dim b As Double
                annual.Text = b
                b = Math.Round(b, 2)
                FirstName.Text = "'" & LCase(dr2(0)).ToString() & "'"
                sick.Text = "'" & LCase(dr2(1)).ToString() & "'"
                Maternety.Text = "'" & LCase(dr2(2)).ToString() & "'"
                floating.Text = "'" & LCase(dr2(3)).ToString() & "'"
                b = "'" & LCase(dr2(4)).ToString() & "'"
                Comptime.Text = "'" & LCase(dr2(5)).ToString() & "'"

            End If

any help?????????????????????

Aucun commentaire:

Enregistrer un commentaire