BatchMove1导记录?欢迎大家讨论!
编程的时候经常会碰到从表1中导记录到表2,表1和表2字段列表是一样的,可能某些字段的类型发生了变化,经高手指点,用BatchMove1到记录非常方便,不敢独享!希望大家一起讨论、进步!
BatchMove1->Destination(目标表Table);
BatchMove1->Source(数据源Query or Table);
BatchMove1->Mode(导记录模式:Delete、Update、Copy等等)
例子如下:
TStringList *theRecord = new TStringList();
Session->GetTableNames(ExtractFilePath(Application->ExeName),"*.db",false,false,theRecord);
for(int i=0; i<theRecord->Count; i++){
Query2->SQL->Clear();
Query2->SQL->Add("Select * from " + theRecord->Strings[i]);
Table1->TableName = theRecord->Strings[i];
BatchMove1->Execute();
}
delete theRecord;
Session、GetTableNames在BCB的帮助中已经注明:
Session, that is automatically created for all database applications. To assign a database component to a different session in a multi-threaded application;
GetTableNames(const AnsiString DatabaseName, const AnsiString Pattern, bool Extensions, bool SystemTables, Classes::TStrings* List);