fast find in .... sql server table suggestion

User avatar
sal21
PlatinumLounger
Posts: 4332
Joined: 26 Apr 2010, 17:36

fast find in .... sql server table suggestion

Post by sal21 »

I just have a ADO CNN connection active on sql server.

I have this two var:

Mydata As date
Mystring as String

I need to find if a pair of this two var are present in mytable based filed F1 (date filed) and F2 (string field)

example:

Mydata=18/06/2022
Mystring="123456"

F1 F2
19/06/2022 123456
18/06/2022 123456
21/06/2022 123456

in my case the relation is present in second row

i can use SEEK, .find or?

User avatar
HansV
Administrator
Posts: 78044
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: fast find in .... sql server table suggestion

Post by HansV »

Mytable must have an index on F1 and F2.

Set the Index property of the recordset to the name of that index.
You can then use the Seek method.
Best wishes,
Hans