oledb use LIKE instead of = ?

mikerob283

Member
Joined
Feb 15, 2005
Messages
12
Programming Experience
Beginner
I finally narrowed a agonizing error down to this one item...
sql = "SELECT * FROM users WHERE username = '" & txtUsername.Text & "'"

will not work, but this will...

sql = "SELECT * FROM users WHERE username LIKE '" & txtUsername.Text & "'"

as you can see the only difference is the = and the LIKE

is that just how oledb works? i didn't have this problem when I used mysql or when I connected to an access database using an jet driver...

I just today uninstalled mysql and installed msde so that when I complete this project it will be minimal change to connect it to the sql server at work for a demonstration.

Oledb also allows me to put this one computers around the office without having to install a driver along with the application.
 

mikerob283

Member
Joined
Feb 15, 2005
Messages
12
Programming Experience
Beginner
I would like to still know what is the reason that I can't use a = .


But I have come to another conclusion, unless I put the %'s around the username it still has to be an exact match in order to gain access....

now I can do the happy dance cause I didn't delete the whole program and start over...
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
Hmm strang I've never had any trouble with the =. Yes unless you add a % in to a like it will be an exact match as the % is the wild card for the pattern. Out of interest why don't you switch over to SQLClient?

TPM
 
Top Bottom