moji moji - 6 months ago 31
Vb.net Question

Conversion from string to type Double is not valid

I want to add a value to a field that has value from before.
My code is:

Dim Credits As Integer = Int64.Parse(FinalPay.ToString)
Dim cmd As New SqlCommand("Update Users Set Credit=Credit+" + Credits +
" Where Email ='" + UserEmail + "'", con)


but I get an error that says


"Conversion from string to double is not valid"

Answer
Dim Credits As Integer = Int64.Parse(FinalPay.ToString)
Dim cmd As New SqlCommand("Update Users Set Credit=Credit+" & Credits & 
                                                " Where Email ='" & UserEmail & "'", con)

When you want to concat a string in vb you want to use the "&" operator