• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

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

0
sivatagiherceg
Asked:
sivatagiherceg
1 Solution
 
johnstonedCommented:
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.
0
 
IPCHCommented:
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
0
 
sagerydCommented:
Why not use SQL?

like so:

Select Field1, Field2 from database.db
  where Field1 like "%book%"
order by Field1


--johan
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now