بسم الله الرحمن الرحيم
السلام عليكم ياأخواني ...
المشكله تحدث عند إستخدام جمله update حيث أنها تقوم بعمل update بنجاح ولكن تضيف فراغ قبل التعديل
مثلا :
كلمه السر : 654 بعد إستخدام جمله الupdate لتغييرها ب 777 تصبح space" 777 وهذا لكل البيانات في الجمله بلا إستثناء
إعتقدت أن المشكله من كود vb2003 ولكني إستخدمت داله Trim _ لازاله كل المسافات _ ولم يحدث تغيير
هذا هو كود الUpdate
Try
Dim cmd2 As New SqlCommand
cmd2.CommandText = "UPDATE profile SET first_name=' " & txt_fname.Text & " ' ,last_name=' " & txt_lname.Text & " ',user_name=' " & txt_user.Text & " ',password=' " & txt_pass1.Text & " ',mobile=' " & txt_mob.Text & " ' WHERE mobile = '" & stb.Text & " ' "
cmd2.Connection = cnn1
cnn1.Open()
str2 = txt_opass.Text.Trim
res = String.Compare(str1, str2)
If res = 0 Then
cmd2.ExecuteNonQuery()
cnn1.Close()
lbl_error.Text = ""
MsgBox("update Seccessfuly . . . ", MsgBoxStyle.Information, "African Mertime Logistics")
'Update the loged user info
loged_user = txt_user.Text
Loged_mobile = txt_mob.Text
'Close Profile form
Me.Close()
Else
lbl_error.Text = " Wrong password !!"
End If
cnn1.Close()
Catch ex As Exception
MsgBox(ex.ToString)
cnn1.Close()
End Try