hi guys, newbie here, I want to make a login page based on VB.NET language and I have a problem

basically, I have a SQL database table named XYZ and the columns are id, username, password, and type

type is to determine wether the user logging in is a user or an admin

so, how to verify that? let's say if I log in as user I will be forwared to user page and if I log in as admin I will be forwarded to admin page...

Recommended Answers

All 3 Replies

a simple if-else statement could do this

if type = admin
goto adminPage
else
goto userPage

thank you for the reply, but what I meant is how to access the table and select the right username and then verify the type... sorry if my first post isn't clear enough...

u will first have to connect to your database... usually I create a class called DataAccess which only consits of the code needed to connect to the database...

links
http://msdn.microsoft.com/en-us/library/ms178371.aspx
http://www.w3schools.com/aspnet/aspnet_dbconnection.asp

..the user enters his username and password...

u can either pass both values to the query... if the query return a result > 0 then it means the username and pass is correct... which then u can check what type it is.

if the query returns 0.. then u know theres an error(username or pass incorrect)

above is the faster way round...and the better way imo

the easier way is to 1st get all the users from the db and then compare them to the username and password...

this however takes longer and will kill the connection if there are thousands of users...

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.