ADO & SQL Statement

04-18-2004, 02:48 AM
I seemed to have lost mysql book and don't know if this is the right statement. My tests show it really really fast much faster than a vb loop.

I have a list in a database. no primary key. Hope my terminalogy is correct.
1 table - 1 field - thousands of records.

Here's the code.

Set RS = New ADODB.Recordset

RS.Open "Select Field from Table WHERE Field = '" & Text1.Text & "'", Connection, adOpenDynamic, adLockOptimistic

If RS.EOF = False Then
MsgBox "Found " & RS("BS")
MsgBox "Not Found"
End If


Does it look OK, because it found an entry in a database with over 400,000 records in under a second.

04-18-2004, 02:53 AM
I think you should be satisified with such a response time.
If you're don't need to move backward in your recordset (.MovePrevious) after opening
and have nothing against its being ReadOnly then

... adForwardOnly, adReadOnly combination should be even faster.


04-18-2004, 03:22 AM
Thanks, I'll try it.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum