From: Joachim Duerr on
iDesmet schrieb in
<1174431105.820132.305250(a)o5g2000hsb.googlegroups.com>:

> No problem and thanks, I've just suscribed to advantage.visual_objects
> newsgroup

but again without some code...in advantage.visual_objects are the same
people, using the same crystal ball ;)

--
Joachim D�rr
Sybase iAnywhere
AdvantageSupport[at]ianywhere.com
From: iDesmet on
On Mar 21, 3:24 am, "Joachim Duerr" <jojo.du...(a)gmx.de> wrote:
> iDesmet schrieb in
> <1174431105.820132.305...(a)o5g2000hsb.googlegroups.com>:
>
> > No problem and thanks, I've just suscribed to advantage.visual_objects
> > newsgroup
>
> but again without some code...in advantage.visual_objects are the same
> people, using the same crystal ball ;)
>
> --
> Joachim Dürr
> Sybase iAnywhere
> AdvantageSupport[at]ianywhere.com

Joachim,

Sorry, I thought you would preffer the whole code.


*The adt.ini file:

[File-Locations]

Data-Path = C:\MigrationADS\Daten\

ADS-DataDict = C:\MigrationADS\AdtTest.add



[System]
SysRDD = ADSADT
RddData = ADT
RddMemo = ADM
RddIndex = ADI
AdsServer = 1

ConvertAdt = 0



[CompareFile]
DoCompareFile = NO


*The Start Method:

//Parameter aus ini-Datei lesen
oIni := IniFile {"adt.ini"}
SetGlobal(#Data_Path, oIni:GetStringUpper("File-Locations", "Data-
Path"))

SetGlobal(#RDDTREIBER,oIni:GetStringUpper("System", "SysRDD"))
SetGlobal(#RDDDATA ,oIni:GetStringUpper("System", "RddData"))
SetGlobal(#RDDMEMO ,oIni:GetStringUpper("System", "RddMemo"))
SetGlobal(#RDDINDEX ,oIni:GetStringUpper("System", "RddIndex"))

SetGlobal(#ADS_Data, oIni:GetStringUpper("File-Locations", "ADS-
DataDict"))

SetGlobal(#ADS_Server,iif(oIni:GetInt("System", "ADSServer")=1, TRUE,
FALSE))

SetGlobal(#ConvertAdt,iif(oIni:GetInt("System", "ConvertAdt")=1,
TRUE, FALSE))

SetGlobal(#DataUpdate, oIni:GetStringUpper("CompareFile",
"DoCompareFile")) // DB- auf Mutationen checken


IF SLen(AllTrim(GetGlobal(#RDDDATA))) = 0
SetGlobal(#RDDDATA ,"DBF")
ENDIF
IF SLen(AllTrim(GetGlobal(#RDDMEMO))) = 0
SetGlobal(#RDDMEMO ,"FPT")
ENDIF
IF SLen(AllTrim(GetGlobal(#RDDINDEX))) = 0
SetGlobal(#RDDINDEX ,"CDX")
ENDIF


//ADS Server Typ setzen (Remote, Internet, Local)
AX_SetServerType(TRUE,FALSE,TRUE)

//Datumsformat setzen: in SQL ist: yyyy-mm-tt normal
AdsSetDateFormat(String2Psz("DD.MM.YYYY"))


// wenn ADS, dann DataDictionary prüfen
IF GetGlobal(#ADS_Server)
//Ansi auf FALSE !
SetAnsi(FALSE)

//wenn das Data Dict nicht vorhanden ist, dann neu anlegen
IF !File(GetGlobal(#ADS_Data))
SELF:CreateDataDict()
lNeuDataDict := TRUE

ELSE
lNeuDataDict := FALSE

ENDIF

IF GetGlobal(#RddData) = "ADT"
nAdsError := AdsConnect60(String2Psz(GetGlobal(#ADS_Data)),
ADS_REMOTE_SERVER+ADS_LOCAL_SERVER, ;
String2Psz("ADSSYS"), String2Psz(""), 0, @hConnect )

AX_SetConnectionHandle(hConnect)

SetGlobal(#AdsConnection, hConnect)

ELSE
IF GetGlobal(#ConvertAdt)
SELF:ConvertAdt()

ENDIF

ENDIF

ENDIF


//Shell Window starten
oMainWindow := StandardShellWindow{SELF}
oMainWindow:Show(SHOWCENTERED)

SELF:Exec()

//nach dem Beenden Verbindung ins Data Dictionary schliessen
IF GetGlobal(#RddData) = "ADT"
AdsDisconnect(GetGlobal(#AdsConnection))
ENDIF


*Tha Database Method:

METHOD Init CLASS dbKunden

SELF:FieldArray := { {"QNAME1" , "C", 35, 0},;
{"QNAME2" , "C", 35, 0},;
{"QADRESSE1" , "C", 35, 0},;
{"QADRESSE2" , "C", 35, 0},;
{"QNUMMER" , "C", 8, 0} }


SELF:IndexArray := {{"Nummer" , "Kunden", "QNUMMER", "QNUMMER",
{|| _Field->QNUMMER}} }

SUPER:Init(GetGlobal(#Data_Path) + "Kunden." +
GetGlobal(#RddData), TRUE, FALSE, GetGlobal(#RDDTREIBER))


*The Init Method of StandardShellWindow:


aServer :={ { #dbKunden , #KUNDEN , "KUNDEN" },;
{ #dbAuftrag , #AUFTRAG , "AUFTRAG" },;
{ #dbArtikel , #ARTIKEL , "ARTIKEL" },;
{ #dbZahlung , #ZAHLUNG , "ZAHLUNG" } }

SELF:Server := aServer

SELF:OpenServer()

From: Joachim Duerr on
iDesmet schrieb in
<1174506851.639561.42250(a)l75g2000hse.googlegroups.com>:

> nAdsError := AdsConnect60(String2Psz(GetGlobal(#ADS_Data)),
> ADS_REMOTE_SERVER+ADS_LOCAL_SERVER, ;
> String2Psz("ADSSYS"), String2Psz(""), 0, @hConnect )
>
> AX_SetConnectionHandle(hConnect)

there's at least one error: you need to check the return value
nAdsError. If it's !=0 (AE_SUCCESS), then hConnect is invalid. If you
now try to open a table using that connection handle (with
AX_SetConnectionHandle you set the connection handle as being active
for the whole workarea), you'll get 5018. I didn't check further, but
this could be one of the error sources.
One possible fix:

nAdsError := AdsConnect60(...)
if nAdsError<>0
AX_Error()
endif


--
Joachim D�rr
Sybase iAnywhere
AdvantageSupport[at]ianywhere.com
From: iDesmet on
> One possible fix:
>
> nAdsError := AdsConnect60(...)
> if nAdsError<>0
> AX_Error()
> endif
>
> --
> Joachim Dürr
> Sybase iAnywhere
> AdvantageSupport[at]ianywhere.com

Joachim,

Thanks for your answer, I've tried your possible fix but when I
compile the Application I get the following error:

"Line 74, entity AX_ERROR is unknown: 51121"
"Line 74, bad function call: 51138"

I checked the DBFAXS library and found that I have no AX_Error
Function. I Reimported the library but still no AX_Error Function.

Do I need to create one? If so, how do I accomplish this task?

Best Regards,
David Desmet

From: Joachim Duerr on
iDesmet schrieb in
<1174594125.030583.45280(a)p15g2000hsd.googlegroups.com>:

> "Line 74, entity AX_ERROR is unknown: 51121"
> "Line 74, bad function call: 51138"

oops - sorry, I meant AdsShowError("Title") from the ACE API.

--
Joachim D�rr
Sybase iAnywhere
AdvantageSupport[at]ianywhere.com