?
Solved

ADOTable + DBGrid in delphi

Posted on 2003-03-31
11
Medium Priority
?
5,137 Views
Last Modified: 2007-12-19
Hello!
I have a ADOTable and one DBGrid
I want to list in DBgrid only the record that match with one criteria
example
only names='john' or only ages > 20
thanks
0
Comment
Question by:tinti
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +3
11 Comments
 

Author Comment

by:tinti
ID: 8237778
thanks
0
 
LVL 27

Accepted Solution

by:
kretzschmar earned 225 total points
ID: 8237788
adotable1.filter := 'names='+quotedstr('john');
adotable1.filtered := true;

or

adotable1.filter := 'ages > 20';
adotable1.filtered := true;

or

adotable1.filter := 'names='+quotedstr('john')+' and ages > 20';
adotable1.filtered := true;

meikl ;-)
0
 
LVL 9

Expert Comment

by:tkalchev
ID: 8237794
Use the Filter property of your ADOTable, for example :


ADOTable1.Filter := 'names="john" or ages>20';
ADOTable1.Filtered := true;

0
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!

 
LVL 9

Expert Comment

by:tkalchev
ID: 8237799
Ops, sorry kretzschmar, you post came while I was writing mine :)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8237816
doesn't matter, tkalchev,
happens sometimes to me too :-))
0
 
LVL 3

Expert Comment

by:rondi
ID: 8237821
Use the Filter property of ADOTable.

eg.

ADOTable1.Filtered := False;
ADOTable1.Filter := 'FirstName like ''*john*''';
ADOTable1.Filtered := True;


or

ADOTable1.Filtered := False;
ADOTable1.Filter := 'Age > 20';
ADOTable1.Filtered := True;
0
 

Author Comment

by:tinti
ID: 8331784
Ok
Sorry for delay
The points go to Kretzschmar
Thanks
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 8331840
just press "accept comment as answer"
upper right of the comment which helps you most

meikl ;-)
0
 

Expert Comment

by:DevNeocles
ID: 8850143
I was just checking the filter to use in AdoTable and it worked like " xxxxx =' ss ' or yyyyyy = ' ff '  "
0
 

Expert Comment

by:Delphiwizard
ID: 23524347
Hi,

How would I accomplish filtering on multiple fields?
This gives an error about using the wrong arguments the moment the filter is applied.
ADOTable1.Filtered := False;
ADOTable1.Filter := '(FirstName like "*john*") AND (Age > 20)';
ADOTable1.Filtered := True;

Open in new window

0
 

Expert Comment

by:Delphiwizard
ID: 23524353
Sorry,

I meaned the following filter. (the previous will work)
ADOTable1.Filtered := False;
ADOTable1.Filter := '(FirstName like "*john*") AND ((Age < 5) OR (Age > 20))';
ADOTable1.Filtered := True;

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month13 days, 16 hours left to enroll

800 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