With xHarbour.com xBuikl:
request _ads
if adsisserverloaded(diskname() + ':' + curdir()) == 0
set server local
aservtype('Local')
else
set server remote
aservtype('Remote')
endif
rddRegister('ads', 1)
rddsetdefault('ADS')
rdd2use('ADS')
does the job of determining the type of connection available and making it
work.
"Ignacio Ortiz de Zúñiga" <
InvalidAccount@ozs.com> wrote in message
news:42a71fa4$[email=
1@ozsrvnegro.ozlan.local...]
1@ozsrvnegro.ozlan.local...[/email]
> Mike,
>
> Check property nServerType: asDEFAULT should first try to connect with the
> remote server, if it fails it will try with the local server.
>
> It maybe necessary that you make a real connection to the ADS server using
> data dictionary (function ADSConnect60). Consult xHarbour documentation
> for further information.
>
> Regards,
>
> "Mike Draper" <
draperm@cogeco.ca> escribió en el mensaje
> news:42a71897$[email=
1@ozsrvnegro.ozlan.local...]
1@ozsrvnegro.ozlan.local...[/email]
>>I spoke too soon.
>>
>> Everything is fine as long as the Advantage Server is running. If I stop
>> the service, the program does not know what to do except fail when it
>> tries to open the first DBF.
>>
>> How do I tell if the Advantage Database server is running?
>>
>> The TAdsDataSouce believes what every I tell it.
>>
>>
>> "Mike Draper" <
draperm@cogeco.ca> wrote in message
>> news:42a71047$[email=
1@ozsrvnegro.ozlan.local...]
1@ozsrvnegro.ozlan.local...[/email]
>>> My fault as usual.
>>>
>>> My small sample worked of course with what seemed like exactly the same
>>> code.
>>>
>>> The thing that was different is I had the Advantage DLLs in the big
>>> project folder and not in the sample test. Unfortunately (meaning
>>> stupidly by me) the Advantage dlls in the project folder were for
>>> Advantage 7.1 and I am running Advantage 7.0.
>>>
>>> I replaced the DLLs and everything is fine.
>>>
>>> Thanks for your help.
>>>
>>> "Ignacio Ortiz de Zúñiga" <
InvalidAccount@ozs.com> wrote in message
>>> news:42a702dd$[email=
1@ozsrvnegro.ozlan.local...]
1@ozsrvnegro.ozlan.local...[/email]
>>>> Mike,
>>>>
>>>> Try to make a small sample that opens the table with DataControls and
>>>> RUN IT. If it does work on design time but not on run time then you
>>>> may have a problem with your advantage libraries.
>>>>
>>>> Regards,
>>>>
>>>> "Ignacio Ortiz de Zúñiga" <
InvalidAccount@ozs.com> escribió en el
>>>> mensaje news:42a701c6$[email=
1@ozsrvnegro.ozlan.local...]
1@ozsrvnegro.ozlan.local...[/email]
>>>>> Mike,
>>>>>
>>>>> There is no difference when using Xailer to access to a Advantage
>>>>> database file than without Xailer. I really do not know what you are
>>>>> doing wrong. The VIA clause is 'ADS' as usual.
>>>>>
>>>>> Regards,
>>>>>
>>>>> "Mike Draper" <
draperm@cogeco.ca> escribió en el mensaje
>>>>> news:42a6f566$[email=
1@ozsrvnegro.ozlan.local...]
1@ozsrvnegro.ozlan.local...[/email]
>>>>>> That works to identify the existence of the Advantage Server.
>>>>>> Thanks.
>>>>>>
>>>>>> What is the name of the 'rdd' (as in 'USE tablename VIA rdd') for
>>>>>> Advantage DBF/CDX/FPT type tables? There is too much code using
>>>>>> 'SELECT tablealias' to convert to dataset terminology.
>>>>>>
>>>>>> "Ignacio Ortiz de Zúñiga" <
InvalidAccount@ozs.com> wrote in message
>>>>>> news:42a6a31f$[email=
1@ozsrvnegro.ozlan.local...]
1@ozsrvnegro.ozlan.local...[/email]
>>>>>>> Mike,
>>>>>>>
>>>>>>> Use the DataControls to do some tests: AdsDataSource, DbfDataSet and
>>>>>>> DBBrowse.
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> "Mike Draper" <
draperm@cogeco.ca> escribió en el mensaje
>>>>>>> news:[email=
42a6434e@ozsrvnegro.ozlan.local...]
42a6434e@ozsrvnegro.ozlan.local...[/email]
>>>>>>>> Using the ADS RDD, I want to know if the Advantage Database Server
>>>>>>>> is loaded or I should use the local server. I tried the statement:
>>>>>>>>
>>>>>>>> if adsisserverloaded(diskname() + ':' + curdir()) == 0
>>>>>>>>
>>>>>>>> It always returns 0 even if the server is running on the current
>>>>>>>> drive.
>>>>>>>>
>>>>>>>> request _ads
>>>>>>>> REQUEST ADSKEYCOUNT, ADSKEYNO, ADSGETRELKEYPOS, ADSSETRELKEYPOS
>>>>>>>> rddRegister('ads', 1)
>>>>>>>> rddsetdefault('ADS')
>>>>>>>> rdd2use('ADS')
>>>>>>>> if adsisserverloaded(diskname() + ':' + curdir()) == 0
>>>>>>>> set server local
>>>>>>>> aservtype('Local')
>>>>>>>> else
>>>>>>>> set server remote
>>>>>>>> aservtype('Remote')
>>>>>>>> endif
>>>>>>>>
>>>>>>>> If I change the 'if(adsserverloaded...' to == 99 to force it to use
>>>>>>>> the server, I get an Advantage error 6313 (Connection error) when I
>>>>>>>> try to open the 1st table.
>>>>>>>>
>>>>>>>> It does work in the Advantage 'local' mode.
>>>>>>>>
>>>>>>>> What should I do?
>>>>>>>>
>>>>>>>> Mike Draper
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>