27-09-13, 07:41 PM
ارجوا المساعدة في تصحيح مشكلة هذا الكود جميع شروط تعمل ولكن المشكلة في update فبعد انهاء جميع الشروط يعطيني مسج بانه تم تغير كلمة المرور ولكن للاسف لا يحدث هذا التغير فما هي المشكلة في الكود ارجوا المساعدة في حله وشرح الخطأ
كود :
Dim da As SqlDataAdapter
Dim dt As DataTable
If txt_user.Text = "" Or txt_ppass.Text = "" Then
MsgBox("Pleaze entre all information", MsgBoxStyle.Information, "Error")
Else
Dim sqlconn As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\m7md\Documents\Visual Studio 2008\Projects\Cars\Cars\cars.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True")
dt = New DataTable
da = New SqlDataAdapter
Dim sql As String = ("select * from tbl_register where db_user='" & txt_user.Text & "' and db_pass='" & txt_ppass.Text & "'")
da = New SqlDataAdapter(sql, sqlconn)
dt.Clear()
da.Fill(dt)
If (dt.Rows.Count = 0) Then
MsgBox("User name not exist/or password not correct")
Else
Label4.Visible = True
txt_npass.Visible = True
Label5.Visible = True
txt_cpass.Visible = True
If Val(txt_npass.Text) = Val(txt_cpass.Text) Then
If txt_npass.TextLength < 8 Then
MsgBox("Password must be at least eight characters ", MsgBoxStyle.Exclamation, "")
Exit Sub
End If
Dim all As New List(Of String)
For Each t In txt_npass.Text
all.Add(t)
Next
If Char.IsUpper(all.Item(0)) = False Then
MsgBox("The first letter must be a Capital")
Exit Sub
End If
Dim upper As Integer = 0
Dim lower As Integer = 0
Dim symbol As Integer = 0
Dim num As Integer = 0
Dim str As String = txt_npass.Text '"Hello$"
For [loop] As Integer = 0 To str.Length - 1
If [Char].IsUpper(str([loop])) Then
upper += 1
ElseIf [Char].IsLower(str([loop])) Then
lower += 1
ElseIf [Char].IsSymbol(str([loop])) Then
symbol += 1
ElseIf [Char].IsNumber(str([loop])) Then
num += 1
End If
Next
MsgBox("Excellent now password is strong ", MsgBoxStyle.Information, "")
sqlconn.Open()
Dim update As New SqlCommand("Update tbl_register set(db_pass)='" & txt_npass.Text & "' where (db_user='" & txt_user.Text & "' )", sqlconn)
sqlconn.Close()
MsgBox("Password has been change", MsgBoxStyle.Information, "Error")
Else
MsgBox("Password not compatible")
End If
End If
End If