采用commandtext传递sql叙述,你需要调用clientdataset的execute
方法
eg:
trans:=CreateTransactionContextEx;
try
olecheck(Trans.createinstance(class_trainrdm,iid_itrainrdm,idm));
//ipp:=cotrainrdm.create;
ipp:=idm as Iappserver;
cds:=TClientDataSet.create(nil);
cds1:=TClientDataSet.create(nil);
cds.data:=datamaster;
s:='insert tb_train_master(sheetid,senddate,worker) values(''%s'',''%s'',''%s'')';
cds1.data:=datadetail;
s1:='insert tb_train_detail(sheetid,gname,number,price) values(''%s'',''%s'',%s,%g)';
n:=0;
try
cds1.first;
for icount:=0 to cds1.RecordCount-1do
begin
s2:=format(s1,[cds1.fieldbyname('sheetid').asstring,
cds1.fieldbyname('gname').asstring,
cds1.fieldbyname('number').asstring,
cds1.fieldbyname('price').asfloat]);
ipp.AS_Execute('DataSetProvider1',s2,p,k);
cds1.Next;
n:=n+1;
end;
cds.first;
for x:=0 to cds.recordcount-1do
begin
s3:=format(s,[cds.fieldbyname('sheetid').asstring,
cds.fieldbyname('senddate').asstring,
cds.fieldbyname('worker').asstring]);
ipp.AS_Execute('DataSetProvider1',s3,p,k);
cds.next;
end;