SEEK Vs FIND FIRST METHOD'S IN VB..........Which is faster?!!

SEEK Vs FIND FIRST METHOD'S IN VB..........Which is faster?!!

Post by Ram Kalyanaram » Fri, 10 Mar 1995 07:15:32



Hi

I would like to know, between 'Seek  on a table object' and 'FindFirst on
a dynaset' methods which is faster?

I have an application in VB where I need to find a specific record in a Access
table in a database. I am right now using a FindFirst method on a dynaset,
which is painfully slow!!

Secondly since the table is involved in a complex relationship (it is both on
the many side as well as the one side), I am not sure how to use the keys in a
seek method. All my experiments with different keys failed.

Thanks in advance for all yr help

Ram

 
 
 

SEEK Vs FIND FIRST METHOD'S IN VB..........Which is faster?!!

Post by Scott Kostak » Sun, 12 Mar 1995 03:27:29



Quote:

>Hi

>I would like to know, between 'Seek  on a table object' and 'FindFirst on
>a dynaset' methods which is faster?

>I have an application in VB where I need to find a specific record in a Access
>table in a database. I am right now using a FindFirst method on a dynaset,
>which is painfully slow!!

>Secondly since the table is involved in a complex relationship (it is both on
>the many side as well as the one side), I am not sure how to use the keys in a
>seek method. All my experiments with different keys failed.

>Thanks in advance for all yr help

>Ram

The .Seek Method is much faster but also more limited.
It can only 'Seek' a value from a Table (not a Dynaset)
and you can only seek in an indexed field.

    search MyIndexedField for SearchValue
                tblMyTable.Index = "MyIndexedField"
                tblMyTable.Seek "=", "SearchValue"

If the Index field you chose is not Unique you will
have to walk thru the table to get the proper record.

        Do While tblMyTable("MyIndexedField") = "SearchValue"
                If tblMyTable("AnotherField") = "AnotherValue"
                        Exit Do
                Else
                        tblMyTable.MoveNext
                End If
        Loop

You can not use the .Seek method on a 'complex relationship'
unless you create a new temp Table to hold the values returned
by your query. You will need to have the Table in your database
already or build the Table in code. You will probably want to
delete all the records before re-populating the Table w/ new
values. I think you should be able to use a 'SELECT INTO' query
(Search the help 'SELECT INTO') to populate the table but I'm
not sure about this. Otherwise you will have to populate the
Table in code.

The overhead of creating a new temp Table will probably not
be worth while unless you are going to do a lot of searching
of the result set. You will need to run some test to find the
most effient method for your app.
--
   ______  
  /     / \\\\\\\\\\\\\\\\\\\/////////////////////        
 /  ___/__             Scott Kostakos              
/__/__/                Only Solutions              

       /   There are no problems, only solutions
 _____/  ////////////////////\\\\\\\\\\\\\\\\\\\\\

 
 
 

SEEK Vs FIND FIRST METHOD'S IN VB..........Which is faster?!!

Post by Jason Kaczo » Sun, 12 Mar 1995 00:59:41



> I would like to know, between 'Seek  on a table object' and 'FindFirst on
> a dynaset' methods which is faster?

> I have an application in VB where I need to find a specific record in a Access
> table in a database. I am right now using a FindFirst method on a dynaset,
> which is painfully slow!!

> Secondly since the table is involved in a complex relationship (it is both on
> the many side as well as the one side), I am not sure how to use the keys in a
> seek method. All my experiments with different keys failed.

SEEK is much faster than findfirst, it is so fast that I have even implemented a
decent spell checker with it (Not perfect, but decent...only 20,000 words, but a
user can add more)....

Quote:> Thanks in advance for all yr help
> Ram

ttyl
Jason
 
 
 

SEEK Vs FIND FIRST METHOD'S IN VB..........Which is faster?!!

Post by FrankM59 » Mon, 13 Mar 1995 12:58:03


Quote:>>Secondly since the table is involved in a complex relationship (it is

both on
the many side as well as the one side), I am not sure how to use the keys
in a
seek method. All my experiments with different keys failed.<<

Seek is far faster than findfirst however, like you have found, it is very
restrictive in it's seek criteria. An Index is a very real requirement.
Also, consider that a Seek will only find the first instance that meets
the seek criteria. That's not all bad since it does this very quickly and,
since an index is used, the remaining data is in indexed order. From that
point, as simple loop, and Table.MoveNext checking to see if the "real"
search criteria that you want has been met, will go very quickly. A
dynaset/snapshot is not required since you can use the table object just
as effectivly in this case.
This may not always be a workable solution but, if it is the speed
increase is great.

Frank....

 
 
 

1. Finding a record without Find/Seek methods...

How can I find a record and make it the current record in my datacontrol
without using the Find or Seek methords?

I am writiing a VB/Oracle Application that uses Oracle Objects For OLE's
DataControl. Since OO4O does not support the Find method I must find
alternate way to find a record via search criteria and make it the current
record.

Any help would be appreciated, thanks,

****************************************************************************
Eddie Hernandez                              North Broward Hospital District
Programmer/Oracle DBA                        1608 SE 3rd Avenue

***************************************************************************

2. ODBC

3. Filter vs Find vs Seek

4. Drill-through in Excel / Pivot Table in OWC

5. Find First, Find Next, Find Previous, Find Last

6. Help! I can't connect to server from enterprise!

7. Help Please - .Find method will not return the first value in a table

8. Filter DateTime based on day of week

9. Field Names containing Spaces and the Find First method

10. Help With Find First Method

11. find first method

12. Seek/Search/Find something real FAST--Help!?!

13. update method in vb 3.0 vs vb 4.0