BatchMove的用法 (转)

BatchMove的用法 (转)[@more@]

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


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10748419/viewspace-996485/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10748419/viewspace-996485/

你可能感兴趣的:(BatchMove的用法 (转))