borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (DSN code versus Sql Server)Next Topic (Deleting a record from a database) New Topic New Poll Post Reply
AndreaVB Forum : Database : How To Improve A Search Solved Topic
Poster Message
boye-i
Level: Scholar

Registered: 22-10-2002
Posts: 43

icon How To Improve A Search

Hi

I have an Access database with an ADO connection. When searching for an ID, i usually use to start searching from the first record till the item is found. Now i have almost 1,000 records and it takes longer than these days to find an item. What is the best approach to this challenge.

Regards
  

____________________________
IKBoye

18-11-2005 at 06:53 PM
View Profile Send Email to User Show All Posts | Quote Reply
Dave Green
Level: Professor


Registered: 20-10-2005
Posts: 90
icon Re: How To Improve A Search

Hi boye-i
I assume your ID that you are searching for is the primary key field and therefore indexed.
Searching through one record at a time is very slow. It doesn't sound like you are using SQL so why dont you use a SQL statement? This will use internal indexing and extract the required record very quickly.
eg
"SELECT * FROM myTable WHERE ID = '" & lsMyRecordRequiredID & "'"

Even if the field is not indexed, using a Select statement is still much faster than stepping and testing each record.

Hope this helps
Dave

____________________________
While Breath.Count>0
       Live(gbRelax)
Wend

18-11-2005 at 07:49 PM
View Profile Send Email to User Show All Posts | Quote Reply
boye-i
Level: Scholar

Registered: 22-10-2002
Posts: 43
icon Re: How To Improve A Search

Many thanks for your wonderful reply. Its now faster than before.

Regards



____________________________
IKBoye

25-11-2005 at 10:15 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : How To Improve A Search Solved Topic
Previous Topic (DSN code versus Sql Server)Next Topic (Deleting a record from a database) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder