Need guidance on retrieving Advantage Database table into xBrowse. I am using the following packages:
1. xHarbour10205_bcc58 from whosaway.com
2. bcc582 from whosaway.com
3. Advantage Database version 8.1
I have done the following so far:
- Downloaded ACE SDK ver 8.1 from Advantage Dev Zone. Copy ace32.dll, adsloc32.dll, axcws32.dll to c:\windows. Copy ace.h to fivewin include folder
- Built ace32.lib from the ACE SDK Ver 8.1 using this command implib ace32.lib ace32.dll. Copy ace32.lib to xHarbour lib folder
- Downloaded the xHarbour10205 contrib folder from whosaway.com. Compile ads1.c adsfunc.c and adsmgmnt.c. Built rddads.lib using this command tlib rddads.lib +ads1.obj +adsfunc.obj +adsmgmnt.obj. Copy rddads.lib to xHarbour lib folder.
- Copy ads.ch, adsexternal.ch, rddads.ch, ace.h to xHarbour include folder.
I compiled my program successfully but when I run it, it fails with exception:
Error BASE/1001 Undefined function: ADSKEYNO
This is my program:
- Code: Select all Expand view RUN
- #include "fivewin.ch"
#include "xbrowse.ch"
#include "ads.ch"
REQUEST ADS
EXTERNAL AdsKeyCount, AdsGetRelKeyPos, AdsSetRelKeyPos
static oWndMain, oWndBias
memvar cXK
#DEFINE cDBPathDir CurDrive()+":\"+CurDir()+"\"
#DEFINE cBiasSpecTable "TL_TirN.Adt"
//--BEG - Main() ---------------------------------------------------------------------------
function Main()
local oFont
private cXK := "BRW"
Init()
DEFINE FONT oFont NAME "Arial" SIZE 0, -12
DEFINE WINDOW oWndMain TITLE "Production 3 Result" ;
MDI MENU BuildMenu() VSCROLL HSCROLL
DEFINE MSGBAR PROMPT "Production 3 Application" ;
OF oWndMain KEYBOARD DATE TIME
ACTIVATE WINDOW oWndMain MAXIMIZED VALID MsgYesNo( "Exit Application?" )
DisplayBiasProduct()
RELEASE oFont
return nil
//-- END - Main() ----------------------------------------------------------------------------
//-- BEG - Init() ----------------------------------------------------------------------------
function Init()
SET EXACT ON
SET AUTOPEN ON
SET EPOCH TO ( YEAR( DATE() ) - 50 )
SET DATE FORMAT 'DD-MM-YY' // Indonesia
SET 3DLOOK ON
SET DIRCASE MIXED
SET FILECASE MIXED
RDDSETDEFAULT( "ADS" )
AdsSetServerType( ADS_LOCAL_SERVER )
AdsSetFileType( ADS_ADT )
AdsLocking( .F. )
AdsRightsCheck( .F. )
Set( _SET_OPTIMIZE, .T. )
return nil
//-- END - Init() ----------------------------------------------------------------------------
//-- BEG - BuildMenu() ----------------------------------------------------------------------------
//function BuildMenu( oWndMain )
function BuildMenu()
local oMenu
MENU oMenu
MENUITEM "View"
MENU
MENUITEM "Product Code - Bias" ;
ACTION DisplayBiasProduct()
ENDMENU
oMenu:AddMdi()
ENDMENU
return oMenu
//-- END - BuildMenu() ----------------------------------------------------------------------------
//-- BEG - getTableName( inDBPathDir ) ----------------------------------------------------------------------------
function getTableName( inDBPathDir )
local cTblName
local aTokens := {}
local numTokens
cTblName := UPPER( inDBPathDir ) //Convert to Upper Case
cTblName := StrTran( cTblName, ".ADT", "") //Remove .ADT from the inDBPathDir
aTokens := HB_ATokens( cTblName, "\", .F., .F.)
numTokens := LEN( aTokens )
return aTokens[ numTokens ]
//-- END - getTableName( inDBPathDir ) ----------------------------------------------------------------------------
//-- BEG - DisplayBiasProduct() ----------------------------------------------------------------------------
function DisplayBiasProduct()
local oBrw, oFont
local cDBPathFileName := cDBPathDir + cBiasSpecTable
local cTblName := getTableName( cDBPathFileName )
local cPasswd := LOWER( cTblName + ALLTRIM( STR( LEN( cTblName ) ) ) )
local cAlias := cTblName
if oWndBias == nil
/* DBUSEAREA( [<lNewArea>], [<cDriver>], <cName>, [<xcAlias>], [<lShared>], [<lReadonly>]) */
DbUseArea( .T., , cDBPathFileName, cAlias, .T. , .T. )
//Decrypt the table
if ( (cAlias)->( AdsIsTableEncrypted() ) ) .AND. (cAlias)->( AdsEnableEncryption(cPasswd) ) == 0
? "Successful Decrypting Table"
else
//? "Error Decrypting Table"
endif
DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-21
DEFINE WINDOW oWndBias FROM 0, 0 TO 40, 90 MDICHILD OF oWndMain TITLE "Bias Tire Specification"
@ 0, 0 XBROWSE oBrw ;
FONT oFont ;
FIELDS (cAlias)->SPKCD, ;
(cAlias)->PBCD, ;
(cAlias)->SIZE, ;
(cAlias)->INCH, ;
(cAlias)->BRND, ;
IF( cXK == 'BRW' , ;
IF( (SUBSTR((cAlias)->SPKCD,2,1)$'BDS'), ;
LEFT((cAlias)->SPKCD,1)+(cAlias)->PTNX+' '+(cAlias)->PTRN, ;
'S'+(cAlias)->PTNX+' '+(cAlias)->PTRN), ;
(cAlias)->PTNX+(cAlias)->PTRN ;
), ;
(cAlias)->PR ;
HEADERS "Spec Code", ;
"Ver", ;
"Tire Size", ;
"Inch", ;
"Brand", ;
"PTRN", ;
"PR";
AUTOSORT ;
OF oWndBias ;
ALIAS (cAlias)
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
oBrw:CreateFromCode()
//oBrw:SetFocus()
oWndBias:oClient := oBrw
oWndBias:Refresh()
ACTIVATE WINDOW oWndBias VALID( (cAlias)->( DbCloseArea() ), oBrw:cAlias := nil, oWndBias := nil, .T. )
RELEASE oFont
else
oWndBias:SetFocus()
endif
return nil
//-- END - DisplayBiasProduct() ----------------------------------------------------------------------------
This is my database table:
https://drive.google.com/open?id=0B2zQUQq-PXH1VVRfOTJMY2xRS3M
This is my program:
https://drive.google.com/open?id=0B2zQUQq-PXH1MFpXcmZJLVRkSU0
Could anyone please guide me on how to proceed? Thank you.
Teddy