0

Hi everyone .

can you help me in making a log in form for administrator using the accounts from the MySql database .. i want to know the code in connecting database, because i am new in SQl database Programming.. example there are 2 fields in SQL database the Username and Password.. the elements inside the field Username is admin and in Password is asusTek. how can i trigger the user if he enter in the wrong Username and Password in two textbox in the form .... I am Using Visual Studio 2005 and my SQL is SQLExpress Edition with SQL server 2005

.... your help means a lot to me as a newbie in SQL database programming thanks
for any one who can give me a simple code of this .. I will accept your reply without any doubt thanks and god blezzz

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by debasisdas
0

Since you are storing user name and password in database, user name field must be the PK of the table(so it is unique and can't be null).

Assuming the above criteria.

run the following query

SELECT COUNT (*) FROM TABLE_NAME WHERE USER_FIELD='USERNAME_THAT_YOU_ENTERED' AND PASSWORD_FIELD='PASSWORD_THAT_YOU_ENTERED'

If the above query returns one (the query will never return >1 as per the above assumption) you have passed correct credentials. In that case proceed further , else re-prompt for the login credentials.

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.