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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TADODataset with Access2000 like "*" 1

Status
Not open for further replies.

TimSNL

Programmer
Sep 11, 2001
119
0
0
AU
SELECT * FROM TBLCustomer WHERE NAME LIKE "*"

The above query works in Access2000. It finds all records with a * character as part of the name.
But if I try and use this query in an ADODataset there are no records returned. How can I make this work?

---------------------------------------
The maggotts always win.
 
There are variations on the implementation of wild cards - depending on your Jet drivers and MDAC.

Similarly, Delphi has variations on this. One of the things I do is test the SQL in the Database Desktop.

I suspect that your [tt]Name LIKE [blue]"*"[/blue][/tt]wildcard should be [tt]NAME LIKE [red]"%"[/red][/tt]

To illustrate some other features - here's a piece of SQL that I use in one of my queries:
Code:
SELECT  pat_handle, first_name, last_name, birth_time, 
                   height, weight, facility_id
  FROM [Patient] 
WHERE ((UCase(Last_Name) LIKE ucase(:last_name)+'%') 
                      AND 
                     (UCase(First_Name) like UCase(:First_Name)+'%')
                     AND
                     (birth_time BETWEEN :dob_s and :dob_e))
  ORDER BY UCase(Last_name) + UCase(First_Name) + str(birth_time);
This is the simplest example, but shows replaceable parameters (not the [red]:[/red]) and functions (eg ucase)

Hope that helps.

Cheers,
Chris [pc2]
 
Thanks for the suggestion it has given us the hint we needed :)

---------------------------------------
The maggotts always win.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top