獲取Table的結(jié)構(gòu)
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
//獲取Table1 字段值、長(zhǎng)度及類型 FlyFeng鳳兮歸來(lái)
AnsiString sType[39]={ "ftUnknown", "ftString",
"ftSmallint", "ftInteger", "ftWord", "ftBoolean",
"ftFloat", "ftCurrency", "ftBCD","ftDate","ftTime",
"ftDateTime","ftBytes","ftVarBytes","ftAutoInc",
"ftBlob","ftMemo","ftGraphic","ftFmtMemo",
"ftParadoxOle","ftDBaseOle","ftTypedBinary",
"ftCursor","ftFixedChar","ftWideString","ftLargeint",
"ftADT","ftArray","ftReference","ftDataSet",
"ftOraBlob","ftOraClob","ftVariant","ftInterface",
"ftIDispatch","ftGuid","ftTimeStamp","ftFMTBcd"};
Table1->Active=true;
AnsiString Info("The fields are: ");
for(int i = 0; i < Table1->FieldCount; i++)
Info = Info+
Table1->Fields->Fields[i]->FieldName +
"(長(zhǎng)度:"+
Table1->Fields->Fields[i]->DataSize +
" 類型: "+sType[Table1->Fields->Fields[i]->DataType] +
")"+ ", ";
ShowMessage(Info);
Table1->Active=false;
}
//---------------------------------------------------------------------------
posted on 2011-11-24 10:38 鳳兮歸來(lái) 閱讀(204) 評(píng)論(0) 編輯 收藏 引用