Hello, i upgraded my windows C++Builder 2010 application from Advantage Local Database to version but now appear the error 5072 when i try to make the delete of a record using a TAdsQuery component. The RequestLive property on TAdsQuery is set to true. The same application (the same executable) works fine with Advantage Local DB DLL/file ver. but fails if i replace the Advantage Local DLL/file with version or

The SQL stantement in the TAdsQuery is simple then a live cursor must be used:


The selected Table (ACCESSO) is a DBF/CDX encrypted table, and it contain 79898 records.

This is the structure:

-- Table Type of ACCESSO.dbf is CDX

Create Table ACCESSO(
   KOFF Numeric( 10 ,0 ),
   KPOS Numeric( 10 ,0 ),
   TIPO Char( 1 ),
   CODICE Char( 13 ),
   CODUTENTE Char( 13 ),
   LINDESCR NVarChar( 80 ),
   CAT Numeric( 3 ,0 ),
   DESCR NVarChar( 80 ),
   MODEL Char( 40 ),
   QUANTITA Numeric( 2 ,0 ),
   PR_LIST Numeric( 14 ,4 ),
   SCONTO Char( 10 ),
   PRSCONT Numeric( 14 ,4 ),
   PR_UNIT Numeric( 14 ,4 ),
   DP Numeric( 6 ,1 ),
   PORTATA Numeric( 5 ,0 ),
   COMPOSIZ Numeric( 3 ,0 ),
   MICROPROC Char( 1 ),
   DISEGNODXF Char( 20 ),
   ACORREDO Numeric( 1 ,0 ),
   MGIMPP Char( 2 ),
   TIPSCL Char( 5 ),
   GRUPPO Char( 1 ),
   BARRARIF Char( 20 ),
   TIPOBARRA Numeric( 1 ,0 ),
   FOTOACC Char( 20 ),
   FOTOINST Char( 20 ),
   TIPOREG Numeric( 3 ,0 ),
   VALUTALIST Char( 5 ),
   PRLISTEURO Numeric( 12 ,2 ),
   POSFAM Char( 3 ),
   DISEGNOH Char( 20 ),
   TIPOACCSP Numeric( 2 ,0 ) );

EXECUTE PROCEDURE sp_CreateIndex90( 'ACCESSO', 'ACCESSO.cdx', 'KPOS', 'KPOS', '', 2, 512, NULL );

Please tell me what is changed from version to the version or if this is an Advantage issue.

Regards, Enrico

asked 16 Nov '13, 05:50

ERav's gravatar image

accept rate: 0%

edited 18 Nov '13, 09:40

Alex%20Wong's gravatar image

Alex Wong

Yes, there is a change in that affects DBF/CDX query with ORDER BY clause that has multiple columns and includes numeric coloumn(s). The problem before the fix was that the results might not be sort correctly. In order to return a live cursor with an ORDER BY clause, the query engine must create an index (or using an existing index) that correctly represents the ORDER BY. However, with DBF/CDX index, it is difficult to devise a general index expressions that correctly sort multiple columns with numeric column(s) (see details below). We decided that instead of returning a live result that may not be correct, the query engine should just return a static cursor that is completely correct. A possible work around is to specify DBF/VFP as the table type. The query engine are able to create index that properly simulate the ORDER BY clause in VFP index.

The guts of the problem is that DBF/CDX index expression with multiple fields must be concatenated with the string + operator. When converting a numeric value into string, it is not straight forward to have the negative value sorted correct. For example, if StrZero() is used to convert the numeric value, the order of the result will be:


In your example, the numeric column involved is a N(1,0) so this would not be a problem. However, the query engine does not check for specific numeric field that may work.


answered 18 Nov '13, 09:39

Alex%20Wong's gravatar image

Alex Wong
accept rate: 42%

Your answer to the original question.
If responding to a request for additional information, please edit the question or use the comment functionality.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 16 Nov '13, 05:50

Seen: 3,478 times

Last updated: 18 Nov '13, 09:40

Advantage Developer Zone Contact Us Privacy Policy Copyright Info

Powered by Advantage Database Server and OSQA
Disclaimer: Opinions expressed here are those of the poster and do not necessarily reflect the views of the company.