10-05-18, 02:43 AM
(آخر تعديل لهذه المشاركة : 10-05-18, 02:44 AM {2} بواسطة عبد العزيز البسكري.)
كود :
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If TextBox2.Text = "" Then
MsgBox(" الرجاء كتابة كلمة المرور القديمة ", vbCritical + vbMsgBoxRight + vbMsgBoxRtlReading, " خطأ ")
TextBox2.Focus()
Exit Sub
End If
If TextBox3.Text = "" Then
MsgBox(" الرجاء عدم ترك حقل كلمة المرور الجديدة فارغا", vbCritical + vbMsgBoxRight, " خطأ ")
TextBox3.Focus()
Exit Sub
End If
If TextBox3.Text <> TextBox4.Text Then
MsgBox(" كلمة المرور الجديدة و كلمة مرور التأكيد غير متطابقتين ", vbCritical + vbMsgBoxRight + vbMsgBoxRtlReading, " خطأ ")
TextBox3.Text = ""
TextBox4.Text = ""
TextBox3.Focus()
Exit Sub
ElseIf TextBox2.Text = TextBox3.Text Then
MessageBox.Show("كلمة المرور الجديدة تشبه كلمة المرور القديمة ", "إدخال خاطيء", MessageBoxButtons.OK, MessageBoxIcon.Error)
TextBox3.Text = ""
TextBox4.Text = ""
TextBox3.Focus()
Exit Sub
End If
Dim n As String
Try
n = (Me.TextBox2.Text)
Dim sqlstr1 As String = "SELECT * FROM USERS WHERE Uusername= '" & TextBox1.Text & "' and Ppassword='" & n & "'"
Dim dataset1 As New DataSet
Dim dataadapter1 As New OleDb.OleDbDataAdapter(sqlstr1, con)
dataadapter1.Fill(dataset1, "USERS")
If Me.BindingContext(dataset1, "USERS").Count = 0 Then
MsgBox("! عفواً كلمة المرور القديمة غير صحيحة ", MsgBoxStyle.Critical, "Error")
Else
If Me.BindingContext(dataset1, "USERS").Count > 0 Then
Try
Dim SavInto As New OleDb.OleDbCommand
Dim ConStr As String = "provider=Microsoft.Ace.OLEDB.12.0;Data Source=" & Application.StartupPath & "DOUSSA.accdb"
Dim Con As New OleDbConnection(ConStr)
SavInto.Connection = Con
SavInto.CommandType = CommandType.Text
SavInto.CommandText = "UPDATE USERS SET Ppassword='" & TextBox3.Text & "' WHERE Uusername ='" & TextBox1.Text & "'"
Con.Open()
SavInto.ExecuteNonQuery()
Con.Close()
MsgBox(":تم تعديل كلمة المرور بنجاح من" & vbNewLine & TextBox2.Text & vbNewLine & " إلى: " & TextBox3.Text)
Me.Hide()
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
Catch ex As Exception
con.Close()
MsgBox(ex.Message)
End Try
End If
End If
Catch ex As Exception
Dim msb As String = "هناك خطأ ورقمه " & Err.Number & " "
Dim mss As String = "ونصه " & Err.Description & " "
MsgBox(msb + mss, MsgBoxStyle.Critical)
End Try
End Subقناتنا على اليوتوب
