Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
If str = "add" Then
''''''ADD NEW RECORD'''''''
If txtName.Text = "" Or txtICNumber.Text = "" Or txtGender.Text = "" Or txtTelNum.Text = "" Or txtUserName.Text = "" Or txtpassword.Text = "" Then
MessageBox.Show("All fields Are Required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
myqry = "INSERT INTO Staff(StaffName,Gender,IcNumber,TelNumber,Username,Password) "
myqry = myqry + "VALUES('" & txtName.Text & "','" & txtGender.Text & "','" & txtICNumber.Text & "','" & txtTelNum.Text & _
"','" & txtUserName.Text & "','" & txtpassword.Text & "')"
mycmd = New OleDbCommand
With mycmd
.CommandText = myqry
.Connection = conn
.ExecuteNonQuery()
End With
Call Set1()
End If
Else
:crushed:
If str = "add" Then
''''''ADD NEW RECORD'''''''
If txtName.Text = "" Or txtICNumber.Text = "" Or txtGender.Text = "" Or txtTelNum.Text = "" Or txtUserName.Text = "" Or txtpassword.Text = "" Then
MessageBox.Show("All fields Are Required", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
myqry = "INSERT INTO Staff(StaffName,Gender,IcNumber,TelNumber,Username,Password) "
myqry = myqry + "VALUES('" & txtName.Text & "','" & txtGender.Text & "','" & txtICNumber.Text & "','" & txtTelNum.Text & _
"','" & txtUserName.Text & "','" & txtpassword.Text & "')"
mycmd = New OleDbCommand
With mycmd
.CommandText = myqry
.Connection = conn
.ExecuteNonQuery()
End With
Call Set1()
End If
Else
:crushed: