Page 1 of 1

ODAC 9.3.9 not searching Key Fields

Posted: Mon 30 Jun 2014 15:37
by JoaoMarcos
Hí,

After installation of new version, combo box in Object Inspector for KeyFields property on Smartquery is not listing the key fields automatically. We have already chacked UpdatingTable property and if te PK constraint is enabled.

We can set it manually, but we are in middle of a conversion from BDE to ODAC and there are too many data sets, so it´s out of question.

We use Delphi 7 and Delphi 2010.

Re: ODAC 9.3.9 not searching Key Fields

Posted: Tue 01 Jul 2014 10:25
by AlexP
Hello,

Filling in the Published properties of the components is incorrect - we have fixed the behavior. However, this will not affect components' functioning, since when generating INSERT/UPDATE/DELETE and other queries, the key field will be still retrieved from the database and queries will be generated correctly.

Re: ODAC 9.3.9 not searching Key Fields

Posted: Tue 01 Jul 2014 19:20
by JoaoMarcos
Thanks for the reply.

If I cannot fill in the published properties then why make the property in question published?

In previous versions the FindKey() function only works when KeyFields is set, that's why we needed to use ObjectInspector, to speed up conversion.

If we leave this property in blanks will FindKey() works??

Thanks,

Re: ODAC 9.3.9 not searching Key Fields

Posted: Thu 03 Jul 2014 09:34
by AlexP
Published properties must be filled in manually by developer, not inside components, i.e., you should set the KeyFields property by yourself. Even if this field is not set, the FindKey method will work correctly, since before searching records, keys will be searched in the table, and if the key field is detected - search will be performed by it.

Re: ODAC 9.3.9 not searching Key Fields

Posted: Mon 07 Jul 2014 18:07
by JoaoMarcos
Hi Alex!

Thanks for your reply, now I understand. Helped a lot.

Thanks

Re: ODAC 9.3.9 not searching Key Fields

Posted: Tue 08 Jul 2014 09:33
by AlexP
You are welcome. Feel free to contact us if you have any further questions.

Re: ODAC 9.3.9 not searching Key Fields

Posted: Tue 09 Sep 2014 14:55
by JoaoMarcos
Post by AlexP » Thu 03 Jul 2014 09:34

Published properties must be filled in manually by developer, not inside components, i.e., you should set the KeyFields property by yourself. Even if this field is not set, the FindKey method will work correctly, since before searching records, keys will be searched in the table, and if the key field is detected - search will be performed by it.
Sorry, but not setting the KeyFields doesn't work. The FindKey() method still needs the KeyFields property to be set. A thing that I haven't mentioned before, is that I use the AutoClose option set to true. FindKey() needs the cursor to be open to work??

Re: ODAC 9.3.9 not searching Key Fields

Posted: Wed 10 Sep 2014 10:22
by AlexP
When using the FindKey() method, we are trying to find key fields in the following order:
1) The fields specified in the KeyFields property;
2) Key fields in the specified table (from metadata)

If the fields are not found, you will get an error "Key fields required to call FindKey or FindNearest".
The error means that you have no key fields in your table.

Yes, this method works only on an open DataSet.