Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nothing from 'LIKE' statement 2

Status
Not open for further replies.

cklzw

Programmer
May 16, 2002
6
GB
I am using ASP and ACCESS.
when i try to use LIKE statement in ACCESS, it doesn't work.
here is an example:
SELECT PlateNumber
FROM SellNumber
WHERE (PlateNumber like 'E457%');
This statement can not return anything.

However, when i use this one:

SELECT PlateNumber
FROM SellNumber
WHERE (PlateNumber='E457 WCY');
it will return a record.

I don't know what's wrong.
Does anybody know the reason? please!!!!!!

Thanks

 
Nothing wrong with the sql statement, when you execute the statements is BOF and EOF of your recordset true (rs.BOF and rs.EOF)?


What version of MDAC are you using?
 
Hi, harmmeijer

the rs.EOF is true.
and sorry, i am not sure what you mean by MDAC, do you mean the way i connect with database? if so, i am using ODBC.

thanks
 
Microsoft Data Access components are the com components (dll) are the drivers to access the data.
You can download MDAC from MS (do not do so unless you have a verry old version).
Don't know where to find the version of MDAC is can be found but in the control panel (in 2000 under Administative tools) => data sources => drivers. You should see the version of your Access driver. Mine is version 4.00.6019.00.

The fact that EOF is true does not mean that you have an empty recordset EOF is true when you do a .MoveLast and a .MoveNext.
 
The preoblem here is that Access expects the * as a wildcard instead of a %. try:
SELECT PlateNumber
FROM SellNumber
WHERE (PlateNumber like 'E457*');


-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
Thank you guys!!
It is working now. :)

that was my fault.
I wrote the search keyword directly in to sql statement, but not as a variable, so database thought that was a string. :p

the "%" does work in ASP page but not in ACCESS.
the "*" does work in ACCESS but not in ASP page.

thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top