Problem with LIKE

I'm using delphi7 connecting to MS Access2000 database using ADO.
I try to use (LIKE) in SELECT statement it's give nothing, but if I put this statement in access query it's work properly.
The statement like this:
ADO_Name.SQL.Text :=  'SELECT * FROM TableName'+
                                     ' where TableName.FieldName like '''+'*'+TextBoxName.Text+'*'+''' order by'+
                                     ' TableName.FieldName ';

This statement is work properly without (LIKE).

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pierre CorneliusCommented:

ADO_Name.SQL.Text :=  'SELECT * FROM TableName'+
                                     ' where TableName.FieldName like '''+'%'+TextBoxName.Text+'%'+''' order by'+
                                     ' TableName.FieldName ';


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hello sir,

  It is not *, replace it with % and give the query as follows

ADO_Name.SQL.Text :=  'SELECT * FROM TableName'+
                                     ' where TableName.FieldName LIKE ''%' + Trim(TextBoxName.Text) + '%'' ORDER BY +
                                     ' TableName.FieldName ';
with regards,
FieldName is some string type I hope, not DATE or TIME ?

Pierre C is correct as is saravananvq.

Access uses DAO which uses '*' for the wild card ADO uses '%'.

You might wonder why Microsoft are still using DAO - its 5 times faster is why......

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.