Advertisement
Guest User

Login

a guest
Oct 2nd, 2019
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Call Connection()
  2. Dim myAdapter As New MySqlDataAdapter
  3. Dim sqlQuery = "SELECT * FROM tb_login WHERE username='" + txtUser.Text + "' AND password='" + txtPass.Text + "'"
  4. Dim myCommand As New MySqlCommand
  5. myCommand.Connection = conn
  6. myCommand.CommandText = sqlQuery
  7. myAdapter.SelectCommand = myCommand
  8.  
  9.         Dim myData As MySqlDataReader
  10.         myData = myCommand.ExecuteReader()
  11.  
  12.         If txtUser.Text = "" Or txtPass.Text = "" Then
  13.             MsgBox("Isi Terlebih Dahulu Username Dan Password", MsgBoxStyle.Exclamation, "Warning!")
  14.         Else
  15.             If myData.HasRows = 0 Then
  16.                 MsgBox("Password Anda Salah", MsgBoxStyle.Critical, "Error!")
  17.  
  18.             Else
  19.                 MenuUtama.Show()
  20.                 Me.Hide()
  21.             End If
  22.         End If
  23.         txtUser.Text = ""
  24.         txtPass.Text = ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement