Board index » delphi » Can I import a .CSV-file with TBatchMove?

Can I import a .CSV-file with TBatchMove?

I'm trying to import a comma-separated valuefile into
a table. Obviously I'm doing something wrong.  But
my mind of thinking won't leave the path it's on...

In the Source-property of my TBatchMove-component
I wrote the filename of my .CSV-file, but got an error
message. "Bad property value". The rest of the
properties seems clear to me (I think).

I'd appreciate any help!

bK

 

Re:Can I import a .CSV-file with TBatchMove?


Quote
"Bj?rn Kristiansen" <bjorn.kristian...@os.telia.no> wrote:
>I'm trying to import a comma-separated valuefile into
>a table. Obviously I'm doing something wrong.  But
>my mind of thinking won't leave the path it's on...

You need to use the ASCII database driver:

1) Set TTable.TableType to ttASCII.
2) Set TTable.DatabaseName to the ALIAS or directory of your CSV.
3) Set TTable.TableName to the filename of the CSV file.
3) Create a "schema" file that defines the format of your CSV file.
4) Do your thing!

I think Borland has a TI that describes the format of the schema file.
If not, go to

  http://www.melander.dk/

and search for "schema".

Share and Enjoy!

+--------------------from usenet----------------------+
|  Anders Bo Melander    | Phone: (+45) 31 87 91 26   |
|  Finsensvej 79, 2. tv. | mailto:and...@melander.dk  |
|  DK-2000 Frederiksberg | http://www.melander.dk     |
|  Denmark               | flameto:bi...@microsoft.com|
+------------------------+----------------------------+

Other Threads