BatchMove的用法

类别:编程语言 点击:0 评论:0 推荐:

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);
}

本文地址:http://com.8s8s.com/it/it29790.htm