i want to retrieve usernames of staff and users from the same table in different columns plus their passwords.how do i do that using vb ?
Depends on which flavour of VB you are using. There is VB Sscript, VB for Applications, VB6 and VB ,Net and they are all slightly different. The easiest method is a a simple SQL query:
Select username, password From TableName
But that wont work with VBS but should work in all the other versions of VB.
A lot depends on what format the data is stored in,
Stuart
here is my query: SELECT STAFF_ID,USER_ID,PASSWORD FROM TABLE WHERE STAFF_ID OR USER_ID = txtUsername.text AND PASSWORD = txtPassword I want the staff to log in with the staff_id and password and the users to login with the user_id and the password.All of these information is stored in the login table.We using VB9.
There is an error in the construction of the SQL Statement. Try this: SELECT STAFF_ID,USER_ID,PASSWORD FROM TABLE WHERE (STAFF_ID = txtUsername.text OR USER_ID = txtUsername.text ) AND PASSWORD = txtPassword
Notice the parentheses around the Staff_ID./User_ID criteria. Always a good thing when mixing OR and AND in the same statement. Forces the SQL parser to evaluate the two OR criteria as a single entity before the AND criteria.
Stuart
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |