Solved

SQL HELP

Posted on 2011-02-12
2
348 Views
Last Modified: 2012-06-21
I am trying to search a field (Caption) in a table.
I know there is (Joey Owens) in the database.
If i type the edit box (Joey Owens) it will find that record just fine.

If i type in Joey by itself it will not find that record.
If I type in Owens by itself it will not find that record.

How can I locate that record by just useing Joey Or Owens ?
with dataModule2.SearhQuery do begin
  Close;
  SQL.Clear;
  SQL.Add('SELECT * FROM Events WHERE Caption =:Name');
  Parameters.ParamByName('Name').Value:= edit1.Text;
  Open;

Open in new window

0
Comment
Question by:Grant1842
2 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 34880407
the + and '' will depend on the sql language you are using ...
  SQL.Add('SELECT * FROM Events WHERE Caption LIKE ''%'' + :Name + ''%'' ');
0
 
LVL 12

Author Closing Comment

by:Grant1842
ID: 34880416
Just What I needed. THanks
0

Featured Post

Independent Software Vendors: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

740 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