Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Product Manuals » DBISAM Version 4 Manual for RAD Studio XE (Delphi) » Using DBISAM » Importing and Exporting Tables and Query Result Sets |
Incoming text file has following layout: Field # Name DataType ------------------------------------- 1 CustomerName ftString 2 ContactName ftString 3 Phone ftString 4 Fax ftString 5 EMail ftString Table has following structure: Field # Name DataType Size ---------------------------------------------- 1 CustomerID ftAutoInc 0 2 CustomerName ftString 30 3 ContactName ftString 30 4 Phone ftString 10 5 Fax ftString 10 6 EMail ftString 30 7 LastSaleDate ftDate 0 Index Name Fields In Index Options ---------------------------------------------- (none) CustomerID ixPrimary
{ In this example we'll use a comma as a delimiter } var IncomingFields: TStrings; begin IncomingFields:=TStringList.Create; try with MyTable do begin DatabaseName:='d:\temp'; TableName:='customer'; if Exists then begin with IncomingFields do begin Add('CustomerName'); Add('ContactName'); Add('Phone'); Add('Fax'); Add('Email'); end; { Date, time, and number formatting left to defaults for this example } ImportTable('d:\incoming\customer.txt', ',',False,IncomingFields); end; end; finally IncomingFields.Free; end; end;
Outgoing text file should have the following layout: Field # Name DataType ------------------------------------- 1 CustomerName ftString 2 ContactName ftString 3 Phone ftString 4 Fax ftString 5 EMail ftString Table has following structure: Field # Name DataType Size ---------------------------------------------- 1 CustomerID ftAutoInc 0 2 CustomerName ftString 30 3 ContactName ftString 30 4 Phone ftString 10 5 Fax ftString 10 6 EMail ftString 30 7 LastSaleDate ftDate 0 Index Name Fields In Index Options ---------------------------------------------- (none) CustomerID ixPrimary
{ In this example we'll use a comma as a delimiter and only export records that have a non-blank email address } var OutgoingFields: TStrings; begin OutgoingFields:=TStringList.Create; try with MyTable do begin DatabaseName:='d:\temp'; TableName:='customer'; if Exists then begin Open; try Filter:='EMail IS NOT NULL'; Filtered:=True; with OutgoingFields do begin Add('CustomerName'); Add('ContactName'); Add('Phone'); Add('Fax'); Add('Email'); end; { Date, time, and number formatting left to defaults for this example } ExportTable('d:\outgoing\customer.txt', ',',False,OutgoingFields); finally Close; end; end; end; finally OutgoingFields.Free; end; end;
This web page was last updated on Thursday, November 16, 2023 at 10:39 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |