Главная страница | назад





Article #16960: Converting ASCII files to Paradox tables

 Question and Answer Database

FAQ1960C.txt   Converting ASCII files to Paradox tables
Category   :Database Issues
Platform    :All
Product    :C++Builder  1.x

Question:
How do I import my ASCII file into a Paradox table?  Can the 
Database Desktop do it?

Answer:
No, the Database Desktop can't do it. 

Drop 1 TBatchMove and 2 TTables on a form.  Set BatchMove1::Mode 
to batCopy, and Source and Destination to Table1 and Table2, 
respectively.  Set Table1::TableName to an empty Paradox 
table created with the same structure as the Ascii file.  
Set Table2::TableName to any non-existant table name such as 
FOO.TXT, and set Table2::TableType to ttASCII.  Double-click 
on the form and type, BatchMove1->Execute() into the created 
OnCreate method.  Press F9 to build and run.  The files FOO.TXT 
and FOO.SCH should be created.  

Now copy the ASCII text file to the directory where FOO.TXT is located.  Open FOO.SCH 
and changed the first line to read the name of the name of the 
ASCII data file instead of "FOO".  Add statements for 
delimiter and separator, and change Filetype= to "varying" if 
appropriate.  Rename FOO.SCH to the name of the ASCII data file 
.SCH.  Back in your program, change Table2::TableName to the 
name of your ASCII data file.  Change BatchMove1::Source to 
Table2 and BatchMove1::Destination to Table1.  F9 to rebuild 
and run. 

You can now open the paradox table in Database Desktop and see 
your data.  If the data did not splice correctly into the target 
fields, you will need to modify your schema file (.sch).

Also see the file ASCIIDRV.TXT in Delphi3, or TI2844 "Using The 
ASCII Driver With Comma-delimited Files", or  Delphi3\Help\Examples\Batchmv.

7/2/98 10:32:32 AM
 

Last Modified: 01-SEP-99