xsharp.eu • Trying to access DBF/CDX through ADS with bTools.bServer
Page 1 of 1

Trying to access DBF/CDX through ADS with bTools.bServer

Posted: Tue Aug 03, 2021 2:46 pm
by hilberg.it
Hi,
I am a new user to X# and I am fascinated by the project. Also still a bit confused. Please excuse some newbie errors. At the moment I am trying to access DBF/CDX files from a remote ADS instance using X# in VisualObjects Dialect.

At the time I cannot access the CDX files and special characters aren't displayed correctly.

I am using XSharp.RDD with RDDSETDEFAULT("AXDBFCDX") and supplied all the required DLLs like ace32.dll. The code looks something like this:

Code: Select all

SetAnsi(true)
RDDSETDEFAULT("AXDBFCDX")

LOCAL _oDbArtikel as bDBServer
_oDbArtikel = bDBServer{"<IP>:<PORT>ADSTestdArtikel"}

IF !_oDbArtikel:setIndex (<IP>:<PORT>ADSTestdArtikel.cdx")
	 Infobox{,,"Index-File cannot be opened!"}:show()
ENDIF

IF _oDbArtikel:seek("1234")
     System.Console.WriteLine("Art: " + (string)_oDbArtikel:fieldGet(#Arname))
ELSE
     System.Console.WriteLine("Art not found!")
ENDIF   
_oDbArtikel:Close()
I can access the DB, but unfortunately I cannot set the index with :setIndex and special characters are not displayed correctly.

Any hints would be highly appreciated!
Thanks already!

Trying to access DBF/CDX through ADS with bTools.bServer

Posted: Tue Aug 03, 2021 3:22 pm
by wriedmann
Hi,
first of all: welcome here!
A question: why do you are using SetAnsi( true ) if SAP recommends to use SetAnsi( false )?
And the second: AFAIK ADS auto-opens the index file so you need to set the controlling order using SetOrder() specifying the controlling index.
Wolfgang

Trying to access DBF/CDX through ADS with bTools.bServer

Posted: Tue Aug 03, 2021 7:40 pm
by hilberg.it
Thanks!
AFAIK ADS auto-opens the index file so you need to set the controlling order using SetOrder() specifying the controlling index.
That is a nice catch! So I don't need to open the CDX file at all. :)
why do you are using SetAnsi( true ) if SAP recommends to use SetAnsi( false )?
Also good point. Do you have a link where SAP recommends this? Because I think the devzone page is down. http://devzone.advantagedatabase.com/

PS. I got the special chars to show up by removing a line

Code: Select all

SetCollation(#CLIPPER)

Trying to access DBF/CDX through ADS with bTools.bServer

Posted: Wed Aug 04, 2021 3:17 am
by wriedmann
Hello,
unfortunately I don't have any links - I have two (paper) books here, and in both there is the recommendation.
About autoopen the index: even the DBFCDX RDD does that, and it has done that since Clipper days.
The index file is opened if it has the same name as the dbf file.
Wolfgang

Trying to access DBF/CDX through ADS with bTools.bServer

Posted: Wed Aug 04, 2021 9:06 am
by ic2
Hello,
hilberg.it wrote:Do you have a link where SAP recommends this? Because I think the devzone page is down. http://devzone.advantagedatabase.com/
First the requested link:
https://devzone.advantagedatabase.com/d ... edures.htm

Here you will read:
"In order for the Advantage RDD to work properly, the SetAnsi value must be False. The Advantage RDD takes care of all conversion and always returns the data in the native Windows format-ANSI. If you incorrectly set SetAnsi() to True in your Advantage application, Visual Objects will incorrectly assume the data from the Advantage RDD is not ANSI and will also perform conversion, which will corrupt your data. The Advantage Visual Objects RDD will use the SetCollation() value to determine if ANSI conversion is necessary as explained below."

(you can easily assume that Wolfgang is right in most things he writes, he's our X#ikipedea here ;)

The official ADS page for ADS from SAP is https://wiki.scn.sap.com/wiki/pages/vie ... =340329321. SAP has mainly neglected ADS, so it's good that if you still need to order licenses, you can do that via X#.

Dick