Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine the type of a dbf file 2

Status
Not open for further replies.

rob444

Programmer
Nov 5, 2002
633
NL
I wrote a very small win 32 bit executable to determine the DBF filetype (dBase / Foxpro / Visual Foxpro ea)
It's a 9kb executable that doesn't need anything except windows to run.

This is the download link:

Rob.
 
Thanks, Rob!

Should come in handy.

Regards,

Mike
 
Brilliant!

Thanks Rob

Regards

Griff
Keep [Smile]ing
 
Like it Rob!

Lee

VisFox Version 6 User / Windows ME
 
In no way to detract from the program rob created, but another way to determine the type of a table is to use SYS(2029)
VFPHelp said:
CLOSE DATABASES
OPEN DATABASE (HOME(2) + 'Data\testdata')
USE Customer && Open customer table

CLEAR
DO CASE
CASE SYS(2029) = '3'
? 'Previous versions of FoxPro'
CASE SYS(2029) = '48'
? 'Visual FoxPro Table'
CASE SYS(2029) = '67'
? 'dBASE IV SQL table, no memo fields'
CASE SYS(2029) = '99'
? 'dBASE IV SQL System table with a memo field'
CASE SYS(2029) = '131'
? 'FoxBASE+ table with a memo field'
CASE SYS(2029) = '139'
? 'dBASE IV table with a memo field'
CASE SYS(2029) = '203'
? 'dBASE IV SQL table with a memo field'
CASE SYS(2029) = '245'
? 'Previous versions of FoxPro with a memo field'
ENDCASE

boyd.gif

 
That's right Craig, only one possible problem:
When opening a DBF file foxpro changes things in some cases.
It's safer to open such a file in another way.
A safe method could also be faq184-3162

Rob.
 
Great work Rob!

But, if it's written in C and it's not much to ask, could you create a .FLL library instead. This way it could be used transparently, I think.

Regards...

Gerardo Czajkowski
ltc.jpg
 
Gerardo,
It's really not necessary in a VFP app as Craig has pointed out - just use SYS(2029)!

Rick
 
It's true what you say Rick, but as Rob notes if one's not careful Foxpro can change the header of DBF files once opened. This utility is useful in such cases.

Gerardo Czajkowski
ltc.jpg
 
Gerardo,

have a look at the sourcecode in FAQ184-3162
which does the same as the executable, WITHOUT modifying the dbf file to a vfp structure using low level functions.

No need to create a .FLL because it can be done simple in VFP itself.

The executable was written to check DBF files WITHOUT the need to have (runtimes of) Foxpro, Visual Foxpro, Dbase or whatever.
It was written in PureBasic to obtain the smallest possible executable possible.

Rob.
 
Rob said:
have a look at the sourcecode in FAQ184-3162
which does the same as the executable, WITHOUT modifying the dbf file to a vfp structure using low level functions.

Thanks for the link, I'll check it.

Gerardo Czajkowski
ltc.jpg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top