moji moji - 6 months ago 15
Vb.net Question

conversion from string Update Users Set Credit= to type Double is not valid

i want to add 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 the error that say


"Convertion 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 us the "&" operator

Comments