Advantage in .net for VO developers

I’ve grown quite fond of Advantage since using it. It’s definitely an excellent solution if you need to deal with DBF files. If you are moving from Visual Objects (VO) to Vulcan or another .net environment you are probably looking at ADO.Net as one of the ways to access your data.

Here is a typical connection string for looking at a directory of DBF’s with CDX indexes. This connection string is for the Advantage .Net data provider.

Data Source=c:\path;ServerType=local|remote;

This assumes that you have your DBF’s in a directory and don’t have and Advantage Data Dictionary. If you are opening your tables using DBServer{ "filename", TRUE, FALSE, "AXDBFCDX" } then that is probably a reasonable assumption.

The CharType is equivalent to the SetCollation command. ADS_ANSI is equivalent to #Windows and ADS_OEM is equivalent to #Clipper. Make sure you get it right, keep accessing the tables in the same way that you do in your VO program.

The DbfsUseNulls defines whether empty values are returned as null values or not. This makes quite a big difference. If you try to cast a value from a RecordSet directly to the type you are interested in and it’s null you will get an exception.
The documentation says that it defaults to False but I’m not convinced. I really ought to double check whether it does or not.

The rest is fairly standard. The one thing that you might want to change is the TrimTrailingSpaces option. I like them to be trimmed but if you want to keep things familiar you might want to turn that off.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s