bluejaguar456 Posted April 24, 2009 Posted April 24, 2009 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 Quote
Administrators PlausiblyDamp Posted April 25, 2009 Administrators Posted April 25, 2009 What code are you currently using to query the database? Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
bluejaguar456 Posted April 25, 2009 Author Posted April 25, 2009 The SQL i am using to query is: sql = "SELECT * FROM UserInfo WHERE [userID] LIKE '%" & Trim(UsernameTextBox.Text) & "%'" Quote
Administrators PlausiblyDamp Posted April 25, 2009 Administrators Posted April 25, 2009 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. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
bluejaguar456 Posted April 25, 2009 Author Posted April 25, 2009 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 Quote
Administrators PlausiblyDamp Posted April 25, 2009 Administrators Posted April 25, 2009 http://www.xtremedotnettalk.com/showthread.php?p=463520#post463520 might be useful then. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.