ADS and autoincremental fields
Posted: Mon Feb 24, 2020 10:38 am
www.FiveTechSoft.com
https://fivetechsoft.com/forums/
This is already supported in DBFCDX.MOISES wrote:Hi,
Is there a way to support it in dbf databases:
Thank you.Code: Select all
{ "ID", "+", 10, 0 }
Code: Select all
#include "common.ch"
#include "dbinfo.ch"
#include "ads.ch"
REQUEST ADS
//REQUEST DBFCDX, DBFFPT
REQUEST HB_LANG_ESWIN, HB_CODEPAGE_ESWIN
//EXTERNAL OrdKeyNo, OrdKeyCount, OrdKeyGoTo, OrdKeyRelPos
EXTERNAL AdsKeyNo, AdsKeyCount, AdsGetRelKeyPos, AdsSetRelKeyPos
PROCEDURE Main()
LOCAL aStruct := { ;
{ "CHARACTER", "C", 25, 0 }, ;
{ "NUMERIC" , "N", 8, 0 }, ;
{ "DOUBLE" , "N", 8, 2 }, ;
{ "DATE" , "D", 8, 0 }, ;
{ "LOGICAL" , "L", 1, 0 }, ;
{ "MEMO1" , "M", 10, 0 }, ;
{ "MEMO2" , "M", 10, 0 }, ;
{ "MYRECNO" , "+", 4, 0 } } /*work ok with + and Autoinc*/
hb_LangSelect( "ESWIN" )
hb_SetCodePage( "ESWIN" )
RddSetDefault( "ADS" )
set date brit
set cent on
set opti on
set dele on
SET SERVER LOCAL
SET AXS LOCKING OFF
SET RIGHTS CHECKING OFF
SET CHARTYPE TO ANSI
SET FILETYPE TO ADT
SetMode(25,80)
cls
WAIT "Exist table: " + iif( hb_dbExists( "testdbf" ), "Si", "No" )
IF !hb_dbExists( "testdbf" )
DbCreate( "testdbf", aStruct, "ADS", .T., "mylias" )
index on CHARACTER to char01
ELSE
USE testdbf NEW ALIAS myalias
SET INDEX TO char01
WAIT "IndexOrder: " + hb_ntos( OrdNumber() ) + " / " + OrdKey()
ENDIF
Browse()
use
RETURN