Link to home
Start Free TrialLog in
Avatar of sivatagiherceg
sivatagiherceg

asked on

Search in paradox table

I need to make a program which search
a string in a paradox table. So, what I actually need is a source code example for the search.
for example the data what i have is
book 1
book 2
Delphi book
Access book  
The search what i need as follow, if i search for word "book" it has to show me all the records which not only starts with the word "book" it has to show me also "delphi book" and "access book" too
thank you in advance

Avatar of johnstoned
johnstoned

I think what you need to do is place a TTable component on your form, and set the table property to the name of your paradox table,

then, assuming the column name is 'Name'

.....

table1.Open;
table1.first;
if table1.locate('Name', 'book', [loPartialKey]) then
  showmessage('Found')
else
  ShowMessage('Not Found');

.....

the loPartialKey bit should mean you find any string containing 'book'.


Dave.
Sorry johnstoned,

but when you use loPartialKey you'll find <book> only if it's in the begining of the searched words. In Paradox there isnt't a statment for that kind of searching. In InterBase there is a CONTAINING staitment that makes all that you want, but unfortunatly Paradox don't supported it.
If you use Paradox you must create a function that collate every substring of field when you looping trought the table records. If you want some source I'll write some for you.

Regards
Ivan
ASKER CERTIFIED SOLUTION
Avatar of sageryd
sageryd
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sivatagiherceg

ASKER

Comment accepted as answer
Thanx for the A! Simple solution huh! ;)
Hi sageryd
You'r welcome any time