int i;
TTable *Table1=new TTable(this);
TTable *Table2=new TTable(this);
if(Form1->OpenDialog1->Execute())
{
Table1->TableName=OpenDialog1->FileName;
Table1->Active=true;
Table2->TableName="temp.dbf";
Table2->TableType=ttFoxPro;
for(i=0; iFieldCount; i++)
{
Table2->FieldDefs->Add(Table1->FieldDefs->Items->Name, Table1->FieldDefs->Items->DataType, Table1->FieldDefs->Items->Size, Table1->FieldDefs->Items->Required);
if(Table1->FieldDefs->Items->DataType==6)
{
Table2->FieldDefs->Items->Precision=8; // How I'm trying to set the number of digits after the decimal point in the dbf file field, but it doesn't work at all
}
}
Table2->CreateTable();
Table2->Active=true;
Table1->First();
Table2->First();
while(!Table1->Eof)
{
Table2->Edit();
Table2->Insert();
for(i=0; iFieldCount; i++)
{
Table2->Fields->FieldByName(Table1->FieldDefs->Items->Name)->AsString=Table1->Fields->FieldByName(Table1->FieldDefs->Items->Name)->AsString;
}
Table2->Post();
Table1->Next();
}
Table1->Active=false;
Table2->Active=false;
}