What's new

Java Admin Login, Register and Dashboard with Mysql Database

Sir pwede po magpatulong paano ko po ipapasok dito yung condition na kapag equal sa admin or cs ang value ng combobox1 mag proceed po.



Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If (String.IsNullOrEmpty(txtuser.Text) = True Or String.IsNullOrEmpty(txtpass.Text) = True) Then
MessageBox.Show("Please enter username and password")
Else
Dim con As SqlConnection = New SqlConnection("Data Source=DESKTOP-DILIAA0;Initial Catalog=mydataBase;Integrated Security=True")
con.Open()
Dim cmd As SqlCommand = New SqlCommand("Select * from TBLUSER where USERNAME='" + txtuser.Text + "' , PASSWORD='" + txtpass.Text + "'", con)
Dim sda As SqlDataAdapter = New SqlDataAdapter(cmd)
Dim dt As DataTable = New DataTable()
sda.Fill(dt)
con.Close()

If (dt.Rows.Count > 0) Then
MessageBox.Show("Login Successful")
KANGOFORM1.Show()
Me.Hide()
Else
MessageBox.Show("Incorrect Username or Password")
txtuser.Text = ""
txtpass.Text = ""
End If
End If
End Sub

1625011265012.png
 
Back
Top