Checking a textbox against a DB field in an IF statement (VB)

timothy2l

Well-known member
Joined
Jul 3, 2003
Messages
61
Checking a textbox against a DB field in an IF statement

How do I check a textbox.text value against a database field in an "IF" statement? For example:

If "Databasefield" <> txtPassword.text Then
lblError.visible = True
datagrid1.visible = False
End if

I already have the connectivity set up and the login works. If the user logs in with a username and corresponding password, then their personal records will be returned to them for editing purposes. However, if they enter a username / password that is not in the database then an empty datagrid is returned. I know this might not be the best password login since it is possible that 2 users could potentially register the same username and password. Im new to this so its the best I can do right now.

Thanks in advance
 
I dont know if I understood you correctly, you have the logging in done, if the user enters good username and pass the datagrid is populated. But if the combination is wrong you have an empty datagrid. Could you show the code you use to get the user authenticated?
As for two people creating same username, you could set the username colum of the database as a primary key, so two same usernames will not be allowed.
 
Back
Top