Hello all,
I have found many references to this issue but no answer. I have a table
with approximately 1,000,000 records. I need to find 1 record by the
primary
key. I have tried many things, but the only thing that seems to work is
ADO's filter property.
The .Find property won't work because the primary key has more than one
field.
The .Seek property isn't sup****ted under SQL Server.
But the .Filter property takes an enourmous amount of time (I don't know
how
much yet, as it has not yet returned the record.)
The code is basically this:
CON.Open "Provider=SQLOLEDB.1;Server=TheServer;Database=TheDatabase"
RS.Open TableName, CON, nRSCursorMode, nRSLockMode, adCmdTableDirect
RS.Filter = "field1='abc' AND field2='def'"
I have tried many combinations of cursor mode & Lock mode, with no
improvement. I have also tried using a command object, again with no
help.
How do I find a record with the primary key using ADO on a SQL Server
database? Surely it shouldn't take hours just to return 1 record. I
could
understand if the fields weren't the primary key, but in this case the key
consists exactly of "field1" and "field2". Shouldn't SQL Server just look
up
the values on the key and return the record?
Isn't there some way to simulate the .Seek method in SQL Server? If I
can't
do it through ADO, can I do it using direct calls to SQL Server, and if
so,
how?
thanks


|