Accessing Foxpro Database

  • Thread starter Thread starter johnsobd
  • Start date Start date
J

johnsobd

I am accessing an existing Foxpro database, of which I have no control
over. I have been successful in accessing all the tables except for
one. This one table I can access the first 9 fields in the table, but
VB.NET will not see any fields past the first nine. I have discovered
that the problem is the 10th field name begins with a 1. I was able to
create a copy of this table, rename the field and can successfully
access it. The problem is that I need to be able to access this table
in its current form.

I am using the OleDBConnection using Provider=VFPOLEDB.1.

Any help would be very much appreciated.

Thanks,
 
Without knowing any further details.... have you tried the AS clause in
your SELECT statement? For example:

SELECT *, 1ThisColumnBlowsUp AS ThisNowWorks FROM Foo

Not sure if this will relieve your situation, but it may be worth
trying.
 
Hi John,

I find it very curious that a "FoxPro" table has a column that begins with
something other than the allowed underscore or alpha characters. I can think
of three possibilities as to how this happened - it's either a DBF created
by something other than FoxPro, or it was created as an Excel spreadsheet
and saved as a DBF, or, after it was created someone changed a column name
using notepad or a Hex editor. I tried making this type of change using
Notepad and when I opened the resulting table I saw only the first column; a
situation similar to what you're seeing.

I'd contact the person who "owns" the table and ask some questions.
 
Hi Jeff,

Brackets are considered string delimiters in FoxPro, so what you'd get is
columns with "field1" and "1.field2" in them. :-)
 
I thank you all for your responses, but unfortunately alias don't work,
and fields seem almost invisible. I do SELECT *, and then do a
fieldcount and only get 9, rather than the expected 120. I could be
mistaken about the DB being FoxPro, but I have tried all diferent Data
Providers and the FoxPro one was the only one that could access it.

I have attempted to contact the creator, but it is a retail recipe
software, and I am creating a new GUI for a touchscreen. They have not
responed to me, Yet (I am still hopeful). Are there any other data
providers that might be able to overlook the fields beginning with
numbers?
 
As a matter of additional info, I have even tried to do an Import with
MS Access 2003, and it too will only show the first 9 fields. I have
downloaded a free DBF Viewer, and it will show all fields.
 
Hi John,

Basically you've got a corrupt table. If you only need this one table and
one time only I'd use the DBF Viewer to save it into another format and then
change the field name. Otherwise I'd contact the vendor to get a fresh copy
of the table.
 
Cindy,

Well, I don't beleive the table is corrupt, that is just what the
vendor decided to name the fields. I have installed software updates
and they are able to write successfully to the table.

I was able to convert the DB to dBaseIV and read it successfully. The
problem is that doing so would break future updates to the retail
software. My intent is to add to the functionality of the retail
software rather than replace it, therefore I need to keep the Database
in tact. Is there any way to Ignore errors or something in my
connection string?

Thanks.
 
Hi John,

No version of FoxPro will open a table with a field that begins with a
numeric value and see all the columns. Perhaps it is, in fact, a dBaseIV
table. If you can open it that way then I suggest you try the OLE DB
provider for Jet, specifying dBaseIV.
 
Thanks, but I can't open it with dBaseIV unless I first convert the
table, which is not the ideal situation for me. I will keep looking.
 
So, I guess the question now is, does anybody know if free utility to
convert from a FoxPro DB to a dBaseIV DB. I could just run a convert
on the table.

Thanks,
 
Yes, I searched Google. Most programs go from DBaseIV to Foxpro, not
the other way around. The few that do it cost mony, I am just looking
for a quick and dirty free script.
 
Back
Top