BatchMove的用法

Currency __declspec(dllexport) BMove(TComponent* Owner,TTable *D,TTable *R)
{
   //把一个表追加到另一个表中(用BatchMove)

   file://AisiString mDATE = "SDATE="+Now().DateString();
   TBatchMove *BM=new TBatchMove(Owner);
   Currency CR=0;
   for(R->First();!R->Eof;R->Next()){
      CR += R->FieldByName("TPRICE")->AsCurrency;
      BM->Source=R;
      BM->Destination=D;
      BM->Mappings->Clear();
      BM->Mappings->Add("PRICE=TPRICE");
      BM->Mappings->Add("PRUNO=PRUNO");
     
file://BM->Mappings->Add(mDATE);
      BM->Mappings->Add("UPRICE=UPRICE");
      BM->Mappings->Add("PCS=PCS");
      BM->Mode=batAppend;
      BM->Execute();
      }
   delete BM;
   return(CR);
}

你可能感兴趣的:(BCB)