how to retrieve two usernames from 1 table

Microsoft Windows xp professional w/serv...
July 30, 2010 at 07:53:00
Specs: Windows XP
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 ?

See More: how to retrieve two usernames from 1 table

Report •


#1
July 30, 2010 at 10:16:18
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


Report •

#2
July 31, 2010 at 04:29:39
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.


Report •

#3
July 31, 2010 at 05:18:37
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


Report •

Related Solutions


Ask Question