0

I wrote a code for a user to enter in their username and authorization, database and datasets and some other information all to be verified within the code. The code works fine but the problem I am having is basic formatting making it run cleaner and checking for all user errors.

I wanted to know how to make it so the user must enter in certain things first before they move on. Right now it lets them enter their username and password correctly but they must alot enter in dataset information to be able to move on, and they really just need to login before not the other stuff...If someone could help me with setting user input I guess that would be great.

**I am using C# code behind in asp.net by the way**

I am including some code below to show you the login code but it realy doesn't relate...
Thanks!

SqlCommand cmd;
            string cmdString = "SELECT [userID] FROM [user_verification] WHERE" + "(([userID] = @username) AND ([auth_lvl] = @authlvl))";
            cmd = new SqlCommand(cmdString, con);
            cmd.Parameters.Add("@username", SqlDbType.VarChar, 50);
            cmd.Parameters["@username"].Value = username.Text;
            cmd.Parameters.Add("@authlvl", SqlDbType.VarChar, 50);
            cmd.Parameters["@authlvl"].Value = authlvl.Text;

            //read information in database
            SqlDataReader myReader;
            myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (myReader.Read())
            {
                Response.Write("Correct Login!");
            }
            else
            {
                Response.Write("Invalid Credentials");
            }
            myReader.Close();
            con.Close();
3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by crishlay
0

I don't really understand the question but if there are fields you need the user to complete use required field validators to make sure they are filled out. You can also use range validators and regular expression validators to check for the format of the input.

Is that what you need?

0

I don't really understand the question but if there are fields you need the user to complete use required field validators to make sure they are filled out. You can also use range validators and regular expression validators to check for the format of the input.

Is that what you need?

Yes, and right now it won't let me enter in the username and password without entering the dataset and database. I wanted to format it so I can check the username and password before I enter in everything else.

0

So at the moment it is requiring you to enter all four pieces of information? Are you using validators? Because they will get in the way if you want to only work with some inputs. MAybe you could post up your code so we can get a look at what is going on?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.