Data Access Worldwide Knowledge Base
Article ID 2276 Article Title ERROR: "Record not found" at Reread after Saving a new record Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2276 KBase Category CONNECTIVITY KITS Date Created 12/08/2006 Last Edit Date 12/08/2006
Article Text
PROBLEM:
I have a Microsoft Access table and use ODBC Connectivity Kit to use it in my applications. The table has an autonumber ID -- and that is the identity column. I am saving a new record and doing a reread on that table. The reread fails -- it says that the record could not be found...
What could that be?
SOLUTION:
Since Visual DataFlex 11 and Connectivity Kit 4, there has been two programming styles that can be used to handle tables in the Application framework: RowId and RECNUM style.
Some of the differences between these styles are:
- There is no explicit recnum column in a standard table. A standard table will not have a column 0.
- Because there is no recnum column, you cannot move a value to it. This means that all of the RECNUM "tricks" such as moving 0 recnum to inactivate a buffer cannot be used.
- A standard table will not expose a recnum index (i.e., no index.0).
- Attempts to use recnum or index.0 in a standard table will result in an error.
When using standard tables, the RECNUM style cannot be used; RowId style is mandatory. When using recnum tables, both RECNUM- and RowId styles can be used.
In this case, your table is probably set to be standard -- that's the default the connection wizard uses. Check the INT file for that table; the RECNUM_TABLE keyword is probably set to NO.
If you keep that keyword set to NO, you will need to use RowID in your programs. If you want to program using RECNUM style, you will need first to make sure the ID in your table fulfill the API requirements:
The API requires every recnum table it accesses to have a record number like column called the record identity. This column can be a logical column or actually exist in the table and it should have the following characteristics:
- Uniquely identify a row
- Be numeric with no decimal places
- Range from 1 to 2^31 (2147483647)
- Be available as a unique index
If it does, you can change the RECNUM_TABLE keyword to YES and your program should work as expected. If it does not, you will need to use RowID in your programs.
Contributed By:
Marcia Booth
Company: Data Access Worldwide
Web Site: http://www.dataaccess.com
Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.
The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.