Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 10th, 2004, 09:09 PM
Dafly98 Dafly98 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 7 Dafly98 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 7 sec
Reputation Power: 0
Question TADOQUERY "Search" not "Filter"

Hey all I have an Access database I wish to "Search" for data in, I am using the TadoQuery Control. I am also doing SQL commands with this component ( Main Reason I am using it ) I have only found ways to Filter Data but not search through it without either filtering or searching by Scanning ( Which is VERY slow ) I need speed! I have database RecordSets that exceed 29k Records. I am using a Jet 4.0 connection. any Ideas?

Thank you,
Jeremy

Reply With Quote
  #2  
Old November 10th, 2004, 11:13 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Click here for more information.
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,713 Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 3rd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Days 11 h 21 m 11 sec
Reputation Power: 1179
Have you tried changing the SQL property of the TADOQuery at runtime.
Code:
with Query1 do
begin
    Close;
    SQL.Clear;
    SQL.Add('SELECT col1, col2, col3');
    SQL.Add('FROM tablename');
    if (sLike <> '') then
        SQL.Add('WHERE col4 LIKE ''' + sLike + '%'' ');
    Open;    
end;

Of course, it would help if tablename has an index for col4 in the above example.
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Puzzle of the Month solved by Keath and KevinADC, superior perl programmers of the month

Reply With Quote
  #3  
Old November 10th, 2004, 11:43 PM
Dafly98 Dafly98 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 7 Dafly98 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 7 sec
Reputation Power: 0
Thank you for your reply, the code you supplied was for Filtering the data not searching. I say Search meaning it Keeps the Whole Record on the Screen and sets the Active Record (Row) to the one found in the Search function.

P.S. I already have the code for my SQL commands finished, which filters the data Perfectly

Thanks Again


Quote:
Originally Posted by Scorpions4ever
Have you tried changing the SQL property of the TADOQuery at runtime.
Code:
with Query1 do
begin
    Close;
    SQL.Clear;
    SQL.Add('SELECT col1, col2, col3');
    SQL.Add('FROM tablename');
    if (sLike <> '') then
        SQL.Add('WHERE col4 LIKE ''' + sLike + '%'' ');
    Open;    
end;

Of course, it would help if tablename has an index for col4 in the above example.

Reply With Quote
  #4  
Old November 11th, 2004, 02:11 AM
Dafly98 Dafly98 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 7 Dafly98 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 7 sec
Reputation Power: 0
After doing some research I found limitations with the TADOQuery component as of which pertain mostly to Searching. And since it does not look like I am going to be able to do what I need with any decently "Short" code I am going to modify my Application and use the Filter property along Side the Regular SQL commands. In testing works much better then I would have hoped and will function for what I need. I do appreciate your help.

Thank you
Jeremy

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > TADOQUERY "Search" not "Filter"


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT