A record can be found by passing a target key already built by calling CTRecord.FindTarget() method. CTRecord.FindTarget() takes as its parameters a pointer to a target key and the find mode.
// find record with a target key
CTRecord ARecord = new CTRecord(ATable);
byte[] key = new byte[256];
int keylen = 256;
// clear the record buffer
ARecord.Clear();
// set the default index to index 0
ARecord.SetDefaultIndex(0);
// populate the 'product' field
ARecord.SetFieldAsString("product", "DISKETTE");
// build the target key
ARecord.BuildTargetKey(FIND_MODE.EQ, key, ref keylen);
try
{
if (ARecord.FindTarget(key, FIND_MODE.EQ))
Console.Write("Record found\n");
else
Console.Write("Record not found\n");
}
catch (CTException err)
{
Console.Write("Find target failed with error {0}\n", err.GetErrorCode());
}