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

Search a certain word in a field...

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
iqmedia
Asked:
iqmedia
1 Solution
 
kretzschmarCommented:
select * from atable where fieldname like "%TheWord%"
0
 
iqmediaAuthor Commented:
Hi kretzschmar,

You're fast...

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

TQ expert.

iqmedia
0
 
iqmediaAuthor Commented:
Hi kretzschmar,

You're fast...

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

TQ expert.

iqmedia
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
nestoruaCommented:
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
 
Mohammed NasmanSoftware DeveloperCommented:
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
 
kretzschmarCommented:
% does also work with access databases
(via ado tested)

meikl ;-)
0
 
iqmediaAuthor Commented:
Hi experts...

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

iqmedia
0
 
iqmediaAuthor Commented:
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
 
iqmediaAuthor Commented:
I think this would be enough.. TQ

iqmedia
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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