MSDAC FindKey does not work?

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
NetSupport
Posts: 5
Joined: Wed 06 Jun 2007 20:08

MSDAC FindKey does not work?

Post by NetSupport » Wed 10 Oct 2007 08:03

Hey!

I have problems using FINDKEY, using MSDAC, latest version

Appearantly, the FindKey does NOT find the record. I have been
using findkey on BDE databases before, with no problem. Is there
anything special regarding FindKey using MSDAC?
I tried IndexFieldNames. Indexname seems to be missing?
I am searching on a integer column.

regards,

Ruud

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 11 Oct 2007 11:59

FindKey locates records by fields that are in the primary key. If you have a table defined like the one below:

Code: Select all

CREATE TABLE [dbo].[emp11](
	[EMPNO] [int] IDENTITY(1,1) NOT NULL,
	[ENAME] [varchar](10) NULL DEFAULT (NULL),
  ...
PRIMARY KEY CLUSTERED
(
	[EMPNO] ASC
)
)
Call to FindKey([10]) will make a record current if the value of its EMPNO field equals to 10.

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 11 Oct 2007 12:01

Use the Locate method for searching records by any field.

lcoelho
Posts: 47
Joined: Wed 13 Apr 2011 13:41

Post by lcoelho » Tue 19 Jul 2011 14:48

How do you use Locate to find a value in any field of the dataset? I thought you need to enter the fields in which to look into as one of the parameters of Locate.

AndreyZ

Post by AndreyZ » Thu 21 Jul 2011 11:36

Antaeus meant that you can choose the fields by which the application will search records with the help of the Locate method, but you cannot obtain such behaviour using the FindKey method.

lcoelho
Posts: 47
Joined: Wed 13 Apr 2011 13:41

Post by lcoelho » Fri 22 Jul 2011 06:37

Okay, I understand. Thank you very much for your reply

Post Reply