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

We encourage new members to introduce themselves here. Get to know one another and share your interests.
Post Reply
hilberg.it
Posts: 75
Joined: Sun Sep 20, 2020 7:25 am
Location: Germany

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

Post 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!
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

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

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
hilberg.it
Posts: 75
Joined: Sun Sep 20, 2020 7:25 am
Location: Germany

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

Post 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)
User avatar
wriedmann
Posts: 3784
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

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

Post 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
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
ic2
Posts: 1863
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

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

Post 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
Post Reply