Mega Code Archive
Converting ASCII to Paradox
Title: Converting ASCII to Paradox
Question: How to Convert an ASCII file to a Paradox Table
Answer:
First create your paradox table to match the structure of the ASCII file.
I - Creationg the scheme file :
Drop on the form 1 TBatchMove and 2 TTable and 1 TButton
click the Batchmove Component and set "Mode" to batCopy, "Source" to Table1
and "Destination" to Table2
click the Table1 component and set "TableName" to (the name of your Paradox table)
click the Table2 component and set "TableName" to ASCII.TXT, "TableType" to ttASCII
Double click on the Button, and Put this code : Batchmove.Execute
Press F9 and click the button the result is the creation of these files :
ASCII.TXT and ASCII.SCH.
II -
Open the ASCII.SCH file with notepad or edit.
you'll get a file like this :
[ASCII]
Filetype=Fixed
Field1=PARADOXField1,Type,length,00 (first field)
-------------
------------
Fieldn=PARADOXFieldn,Type,length,Position (first char of the last field)
CharSet=ascii
;end of the file
Type : must be Char, Float,....
Lenght : length of each field of the paradox file
position: position of the first char or number in your ascii file position begin with '00'
if your ascii file contain separator (for example ';')
add this line after Filetype
Separator=;
Then change [ASCII] to the name of your Ascii file
Change 'Filetype=' from Fixed to Varying
Save the Sheme file to the name of your ASCCI file (SaveAs)
in your form make these change
Table2 : Set 'TableName' to the name of your ascii file
Batchmove: Set 'Source' to Table2 and 'Destination' to Table1
Run your program and click in the Button.
Now open your Paradox table with Database Desktop.
N B : if you have float or numeric field make change of the lenght of these field in your Scheme File.