I got two table where is table_staff and table_customer, i want to do either one user can log in with using their data(id&password), below is my code to when click "Send" button, it didn't work. Did anybody found my error?
Private Sub btn_send_Click(sender As Object, e As EventArgs) Handles btn_send.Click
Dim mysql As String = "SELECT (SELECT count(*) as num_matches FROM tbl_staff where staff_id = """ & txt_name.Text & """ And staff_pwd = """ & txt_pwd.Text & """ ) As 1, (SELECT count(*) as num_matches FROM tbl_customer where customer_id = """ & txt_name.Text & """ And customer_pwd = """ & txt_pwd.Text & """ ) As 2"
Dim mydatatable As New DataTable
Dim myreader As New OleDb.OleDbDataAdapter(mysql, myconnection)
myreader.Fill(mydatatable)
Dim num_matches As String = mydatatable.Rows(0).Item("num_matches")
If num_matches = 1 Or num_matches = 2 Then
frm_mainmenu_a146292.Show()
Me.Hide()
Else
txt_name.Text = ""
txt_pwd.Text = ""
MsgBox("Incorrect Username or Password")
End If
End Sub