13-02-19, 11:56 PM
السلام عليكم انا عملت برنامج بالفيجوال بيسك وقاعدة بيانات sql server في نموذج تغيير كلمة المرور يحتوي على 4 تيكست بوكس
وهذا كود تغيير كلمة المرور من اختار اضغط على الزر تضضهر النافذة الموجوده بالصوره
Try
If txtid.Text = "" Then
MsgBox("من فضلك ادخل اسم المستخدم")
ElseIf txtpass.Text = "" Then
MsgBox("من فضلك ادخل كلمة المرور الحالية")
ElseIf TextBox3.Text = "" Then
MsgBox("من فضلك ادخل كلمة المرور الجديدة")
ElseIf TextBox4.Text = "" Then
MsgBox("من فضلك أعد كتابة كلمة المرور الجديدة")
Else
MsgBox("done")
Dim idname As String = ""
Dim pw As String = ""
Dim STR = "select * from admin Where ID='" & txtid.Text
Dim adp = New SqlDataAdapter(STR, sqlcon)
Dim Ds = New DataSet
adp.Fill(Ds)
Dim DT As DataTable
DT = Ds.Tables(0)
If DT.Rows.Count <> 0 Then
idname = (DT.Rows(0).Item("id"))
pw = (DT.Rows(0).Item("password"))
End If
If idname = txtid.Text And pw = txtpass.Text Then
Dim sqlpic = "update admin set password=@password where id ='" & (txtid.Text) & "'"
Dim cmdpic As New SqlCommand(sqlpic, sqlcon)
cmdpic.Parameters.Add(New SqlParameter("@password", TextBox3.Text))
cmdpic.ExecuteNonQuery()
MsgBox("تم تغيير كلمة المرور بنجاح")
Me.Hide()
Form3.Show()
Else
MsgBox("المعلومات المدخلة خاطئة")
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "info")
End Try
وهذا كود تغيير كلمة المرور من اختار اضغط على الزر تضضهر النافذة الموجوده بالصوره
Try
If txtid.Text = "" Then
MsgBox("من فضلك ادخل اسم المستخدم")
ElseIf txtpass.Text = "" Then
MsgBox("من فضلك ادخل كلمة المرور الحالية")
ElseIf TextBox3.Text = "" Then
MsgBox("من فضلك ادخل كلمة المرور الجديدة")
ElseIf TextBox4.Text = "" Then
MsgBox("من فضلك أعد كتابة كلمة المرور الجديدة")
Else
MsgBox("done")
Dim idname As String = ""
Dim pw As String = ""
Dim STR = "select * from admin Where ID='" & txtid.Text
Dim adp = New SqlDataAdapter(STR, sqlcon)
Dim Ds = New DataSet
adp.Fill(Ds)
Dim DT As DataTable
DT = Ds.Tables(0)
If DT.Rows.Count <> 0 Then
idname = (DT.Rows(0).Item("id"))
pw = (DT.Rows(0).Item("password"))
End If
If idname = txtid.Text And pw = txtpass.Text Then
Dim sqlpic = "update admin set password=@password where id ='" & (txtid.Text) & "'"
Dim cmdpic As New SqlCommand(sqlpic, sqlcon)
cmdpic.Parameters.Add(New SqlParameter("@password", TextBox3.Text))
cmdpic.ExecuteNonQuery()
MsgBox("تم تغيير كلمة المرور بنجاح")
Me.Hide()
Form3.Show()
Else
MsgBox("المعلومات المدخلة خاطئة")
End If
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "info")
End Try