Searching Access 2003 database for string

bluejaguar456

Well-known member
Joined
Aug 22, 2006
Messages
47
Hey Guys,

I am wanting to search a database for a specific word, well user name. At the moment if the username is eb123 and i type in eb it finds the username. i want it to be able to only find the username if the full text is typed can this be done?

If you know of a more effective way of storing use settings password usernames etc please let me know.

Thanks
 
The SQL i am using to query is:

Code:
sql = "SELECT * FROM UserInfo WHERE [UserID] LIKE %" & Trim(UsernameTextBox.Text) & "%"
 
Code:
sql = "SELECT * FROM UserInfo WHERE [UserID] =" & Trim(UsernameTextBox.Text) & ""

would do the trick, however be aware that concatenating strings like that can cause other problems (including security risks), you would be much better off using a parameterised query instead.
 
Thanks,

i will have a look at a parameterised query, i have never used those before as i am still learning and this is my first big project.

Thanks Again
 
Back
Top