![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » DBISAM Technical Support » Product Manuals » DBISAM Version 4 Manual for RAD Studio 2007 (C++) » 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 { TStringList *IncomingFields=new TStringList; try { MyTable->DatabaseName="d:\\temp"; MyTable->TableName="customer"; if (MyTable->Exists) { IncomingFields->Add("CustomerName"); IncomingFields->Add("ContactName"); IncomingFields->Add("Phone"); IncomingFields->Add("Fax"); IncomingFields->Add("Email"); // Date, time, and number formatting left // to defaults for this example MyTable->ImportTable("d:\\incoming\\customer.txt", ",",false,IncomingFields); } } __finally { delete IncomingFields; } }
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 TStringList *OutgoingFields=new TStringList; try { MyTable->DatabaseName="d:\\temp"; MyTable->TableName="customer"; if (MyTable->Exists) { MyTable->Open(); try { MyTable->Filter="EMail IS NOT NULL"; MyTable->Filtered=true; OutgoingFields->Add("CustomerName"); OutgoingFields->Add("ContactName"); OutgoingFields->Add("Phone"); OutgoingFields->Add("Fax"); OutgoingFields->Add("Email"); // Date, time, and number formatting left // to defaults for this example MyTable->ExportTable("d:\\outgoing\\customer.txt", ",",false,OutgoingFields); } __finally { MyTable->Close(); } } } __finally { delete OutgoingFields; } }
This web page was last updated on Thursday, November 16, 2023 at 10:39 AM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |