Adarsh
Adarsh

Reputation: 59

checking username and password from a ms access database

I'm creating a LMS. It has a part which checks the username and password from the database and grants access but i dont know how to do that.here is the code.

                {
                    if (uname.Text == "" || pass.Text == "")
                    {
                        MessageBox.Show("Fields cannot be left blank.");
                    }
                    else
                    {
                        if (uname.Text != "member")
                        {
                            MessageBox.Show("Username Incorrect.");
                        }
                        else if (pass.Text != "member")
                        {
                            MessageBox.Show("Password Incorrect");
                        }
                        else
                        {
                            Form3 frm = new Form3();
                            frm.Show();
                        }

Now here i need to change "member" to the values that i have entered in the password database.Here is the database the database is successfully linked

how do i make read like if "username from my database"== myusername and same for password?

Upvotes: 0

Views: 697

Answers (1)

Rami Far
Rami Far

Reputation: 404

you can put query like this

Select * from passdb where username=@user and password=@pass;

for checking null fields you can put validators.

Upvotes: 1

Related Questions