Solved

Search a certain word in a field...

Posted on 2002-05-19
9
156 Views
Last Modified: 2010-04-04
Hi experts,

How to search a certain word in a field of a record?

Field | Title                     | Year |
Data  | Monkey in the blue bottle | 1997 |

I just entered 'blue' and it will come out the above data.
I'm using D3 and MSAccess database.

TQ

iqmedia
0
Comment
Question by:iqmedia
9 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 200 total points
Comment Utility
select * from atable where fieldname like "%TheWord%"
0
 

Author Comment

by:iqmedia
Comment Utility
Hi kretzschmar,

You're fast...

Is that all???? shisssss.... OK I'll try it first.

TQ expert.

iqmedia
0
 

Author Comment

by:iqmedia
Comment Utility
Hi kretzschmar,

You're fast...

Is that all???? shisssss.... OK I'll try it first.

TQ expert.

iqmedia
0
 
LVL 4

Expert Comment

by:nestorua
Comment Utility
HI,
Another method (in this case you don't need to change your
SQL if you use someone):
in the OnFilterRecord event of your TDataset write the following:
Accept:=Pos('blue', Dataset.FieldByName('Title').AsString)>0.
Sincerely,
Nestorua.
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

 
LVL 22

Expert Comment

by:mnasman
Comment Utility
Hello

  if you are using Access database, you have to use * instead of %
 your SQL statment will be as:

Select * from urTable where Title like '*blue*'

0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
% does also work with access databases
(via ado tested)

meikl ;-)
0
 

Author Comment

by:iqmedia
Comment Utility
Hi experts...

i got stuck yesterday and with these all comment i'll try to do it again... TQ experts.

iqmedia
0
 

Author Comment

by:iqmedia
Comment Utility
Hi experts,

I got this error by doing that:
General SQL Error [Microsoft][ODBC Microsoft Access 97 Driver] Expression cannot be used with the LIKE predicate.

but then I change Access 97 to Paradox 7 and do this, and it work:

var wordtofind : string;
begin
  Edit1.Text := wordtofind;
  with Query1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('SELECT * FROM tableBook');
    SQL.Add('WHERE Title LIKE "%' + wordtofind + '%"');
    Open;
  end;
end;

iqmedia
0
 

Author Comment

by:iqmedia
Comment Utility
I think this would be enough.. TQ

iqmedia
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

9 Experts available now in Live!

Get 1:1 Help Now