ODAC 9.3.9 not searching Key Fields

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
JoaoMarcos
Posts: 26
Joined: Fri 28 Jun 2013 20:26

ODAC 9.3.9 not searching Key Fields

Post by JoaoMarcos » Mon 30 Jun 2014 15:37

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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ODAC 9.3.9 not searching Key Fields

Post by AlexP » Tue 01 Jul 2014 10:25

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.

JoaoMarcos
Posts: 26
Joined: Fri 28 Jun 2013 20:26

Re: ODAC 9.3.9 not searching Key Fields

Post by JoaoMarcos » Tue 01 Jul 2014 19:20

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,

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ODAC 9.3.9 not searching Key Fields

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.

JoaoMarcos
Posts: 26
Joined: Fri 28 Jun 2013 20:26

Re: ODAC 9.3.9 not searching Key Fields

Post by JoaoMarcos » Mon 07 Jul 2014 18:07

Hi Alex!

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

Thanks

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ODAC 9.3.9 not searching Key Fields

Post by AlexP » Tue 08 Jul 2014 09:33

You are welcome. Feel free to contact us if you have any further questions.

JoaoMarcos
Posts: 26
Joined: Fri 28 Jun 2013 20:26

Re: ODAC 9.3.9 not searching Key Fields

Post by JoaoMarcos » Tue 09 Sep 2014 14:55

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??

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ODAC 9.3.9 not searching Key Fields

Post by AlexP » Wed 10 Sep 2014 10:22

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.

Post Reply