Visual Basic.Net & DBF files

J

JimmyKoolPantz

I have been given the task of converting a program from VFP (visual
foxpro) to Visual Basic.net. My question is "Is it possible to
generate a DBF file Dynamically(at runtime) using Visual Basic.Net?"
With all the field properties, such as, field length and type. I'm not
sure if this is a stupid quesiton or If I am just over looking
something, but I have not found solid information on the internet about
this topic.

Any useful information would greatly be appreciated.

Further Information:
1. The program I am coding, opens up various types of data (.txt,
..xls, .dbf) and processes the data files and then exports as a .dbf
file.

2. The program also opens existing dbf files, searches for companies,
and the then alters the dbf file and also creates a new dbf with just
company names.

Since the primary postal software that we use only supports dbf files,
I need to generate dbf files. (note: all the data files I am working
with do not have the same pattern, they come in different structures
(different data columns))

I have been pondering on a few things about this topic but am seeking
professional advise before I start programming.
 
G

GhostInAK

Hello JimmyKoolPantz,

Check out System.Data.OleDb, and connectionstrings.com

Enjoy
-Boo
 
C

Cindy Winegarden

Hi Jimmy,

Assuming that your DBFs are FoxPro files you can use the latest FoxPro and
Visual FoxPro OLE DB data provider, downloadable from
msdn.microsoft.com/vfoxpro/downloads/updates . You can create tables using
the CREATE TABLE statement; you can read about it in the VFP section of the
MSDN Library.
 
D

diego

Hi Jimmy,

Another thing that you should consider is how index files associated
with the .DBF's will be updated.



Ayon kay JimmyKoolPantz:
 
J

JimmyKoolPantz

Cindy,

The DBF file's will not be FoxPro files, Basically what I will be doing
is converting text file, excel files, CSV files, to DBF files, such as,
What microsoft does when you export a table/query from microsoft
access, and save as a "DBF".

I don't have a problem connecting to a dbf file and creating a dataset
with the file information, but, I do forsee a problem (which I have not
yet began to code) updating or creating a new dbf file. If this is as
easy as generating a xml, txt, excel from visual studio, than this
should not be a problem. One thing I do question is the .cdx file that
is associated with the dbf file. Is this .cdx file required or is this
..cdx file something that vfp has generated. Please keep in mind the
program that I am writing in visual studio will be replacing vfp
program.

a few program details:
The program I am creating imports various data types into
datasets/tables, then processes ithe nformation within the
dataset/tables, then exports as a dbf file. Such as, the way microsoft
access does when you import various file types, and then export as a
dbf file. The only difference is my program has data intelligence that
will determine the length and data type for each column then add a few
columns if needed. This should reduce mistakes, and reduce processing
time.

Another task, is opening a dbf file (an existing dbf file), filter
through each record and seperate residents from companies. Some of our
clients do not want to mail information to companies, so I set up an
xml file with various key words which will be used as filters, I want
to alter the existing dbf file (pull out company names or if needed
create a new dbf file) and I also want to create a new dbf file with
just company names.
 
C

Cindy Winegarden

Hi Jimmy,
The DBF file's will not be FoxPro files, Basically what I will be doing
is converting text file, excel files, CSV files, to DBF files, such as,
What microsoft does when you export a table/query from microsoft
access, and save as a "DBF".

Using the VFP OLE DB data provider, you can't create Dbase III/IV compatible
files, which is what Excel creates. If the other apps that will consume your
DBFs can access Visual FoxPro tables then you can use the FoxPro OLE DB data
provider. Otherwise you'll have to find something to work with Dbase III/IV
DBFs.
I don't have a problem connecting to a dbf file and creating a dataset
with the file information, but, I do forsee a problem (which I have not
yet began to code) updating or creating a new dbf file. If this is as
easy as generating a xml, txt, excel from visual studio, than this
should not be a problem. One thing I do question is the .cdx file that
is associated with the dbf file. Is this .cdx file required or is this
.cdx file something that vfp has generated. Please keep in mind the
program that I am writing in visual studio will be replacing vfp
program.

Since you're referring to CDX indexes, your DBF tables are FoxPro tables.
Early versions of FoxPro Tables were DBase III/IV compatible. Fox tables
come in 3 parts, the DBF which is the table itself, the FPT (optional) which
contains any data that is in Memo fields, and the CDX (optional) which is an
index file. Other DBF versions have IDX and MDX files (I'm not very familiar
with MDX files). The Fox data engine takes care of keeping CDX indexes
updated if they exist.
a few program details:
The program I am creating imports various data types into
datasets/tables, then processes ithe information within the
dataset/tables, then exports as a dbf file. Such as, the way microsoft
access does when you import various file types, and then export as a
dbf file. The only difference is my program has data intelligence that
will determine the length and data type for each column then add a few
columns if needed. This should reduce mistakes, and reduce processing
time.
Another task, is opening a dbf file (an existing dbf file), filter
through each record and seperate residents from companies. Some of our
clients do not want to mail information to companies, so I set up an
xml file with various key words which will be used as filters, I want
to alter the existing dbf file (pull out company names or if needed
create a new dbf file) and I also want to create a new dbf file with
just company names.

It's really a shame that you're trying to replace a Fox app of this type
with a VB app. Since FoxPro has a built in data engine, the kinds of data
handling that you describe are about 10 times easier in FoxPro than they are
any non-data centric language like VB. Also, Even the latest versions of
FoxPro (Visual FoxPro 9) can export data in the Dbase III/IV compatible
format.

Don't get me wrong - I like VB, but for data manipulation (Visual) FoxPro is
so much easier.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top