'Imports System.Data
Imports System.Data.SqlClient
Public Class ChgPass
Dim Conn As SqlConnection
Dim com As New SqlCommand()
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Conn = New SqlConnection("Data Source=ANGELICZINC-PC\SQLEXPRESS;Initial Catalog=cooprative system;Integrated Security=True")
Conn.Open()
com.CommandType = CommandType.Text
If TextBox4.Text = "memzinc" And TextBox3.Text = "010976378" Then
If TextBox5.Text = TextBox6.Text Then 'TextBox5.Text เป็นpasswordใหม่ที่ให้กรอก TextBox6.Textเป็นpasswordใหม่ที่ให้กรอกอีกครั้ง
com = New SqlCommand("update LoginOfficer set PassWord = TextBox5.Text where UserName = memzinc", Conn)
com.Parameters.Add("PassWord", SqlDbType.VarChar).Value = TextBox5.Text.Trim()
MsgBox("You change password of Memzinc successfuly!")
'main.Show()
'Me.Hide()
Else : MsgBox("Password and Re-Password is not match!!,Please enter Password and Re-Password again")
TextBox5.Text = ""
TextBox6.Text = ""
End If
ElseIf TextBox4.Text = "micnamai" And TextBox3.Text = "12345" Then
If TextBox5.Text = TextBox6.Text Then
com = New SqlCommand("update LoginOfficer set PassWord = TextBox5.Text where UserName = micnamai", Conn)
com.Parameters.Add("PassWord", SqlDbType.VarChar).Value = TextBox5.Text.Trim()
MsgBox("You change password of Micnamai successfuly!")
'main.Show()
'Me.Hide()
Else : MsgBox("Password and Re-Password is not match!!,Please enter Password and Re-Password again")
TextBox5.Text = ""
TextBox6.Text = ""
End If
ElseIf TextBox4.Text = "" Or TextBox3.Text = "" Then
MsgBox("Please enter Username/Password")
ElseIf MsgBox("Invalid username/password, Please enter Username/Password again") Then
TextBox4.Text = ""
TextBox3.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
End If