i have made a simple login page with 2 textboxes for username and password and a button to login.
the usernames and passwords are in an sql database . how would i go about retrieving the username and password from the database.
i have tried a select where statement

If TxtUsername.Text = "" And TxtPassword.Text = "" Then
MessageBox.Show("Please enter username and password")

ElseIf TxtUsername.Text = "" Then

MessageBox.Show("Please enter username")
ElseIf TxtPassword.Text = "" Then

MessageBox.Show("Please enter Password")

ElseIf SqlDataAdapter1.SelectCommand.CommandText "SELECT * FROM Managers WHERE managerID = '+ TxtUsername.Text +' and password = '+ txtPassword.text+ " Then
FrmManView.Show() .
but this does not appear to do anything, what am i doing wrong? i am a beginner so any help will be appreciated thanks

ElseIf SqlDataAdapter1.SelectCommand.CommandText "SELECT * FROM Managers WHERE managerID = '+ TxtUsername.Text +' and password = '+ txtPassword.text+ " Then
FrmManView.Show()

you not checked input just select data from input.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.