Solved

Search in paradox table

Posted on 2000-05-16
6
192 Views
Last Modified: 2012-05-05
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
Comment
Question by:sivatagiherceg
6 Comments
 

Expert Comment

by:johnstoned
Comment Utility
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
 
LVL 2

Expert Comment

by:IPCH
Comment Utility
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
 
LVL 1

Accepted Solution

by:
sageryd earned 15 total points
Comment Utility
Why not use SQL?

like so:

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


--johan
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:sivatagiherceg
Comment Utility
Comment accepted as answer
0
 
LVL 1

Expert Comment

by:sageryd
Comment Utility
Thanx for the A! Simple solution huh! ;)
0
 

Author Comment

by:sivatagiherceg
Comment Utility
Hi sageryd
You'r welcome any time
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Windows Drag & Drop Location 2 85
code issue 8 84
LAN or WAN ? 11 58
tvirtualstringtree freeze when load too manny images 10 22
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now