给你个例子:
//取得数据多表:
function TCommdict01.GetHspBaseInfo(const FieldValue: WideString): OleVariant;
var
Igetdef:IManage_datalink;
sqlstr:string;
IGetapp:IAppserver;
begin
Result:=s_ok;
try
Options:=[grMetaData];
if FieldValue<>'' then
begin
sqlstr:='select a.HspID,a.HspName,a.HspCorpCode,a.HspCorpName,a.HankAccount,'+
'a.HankName,a.CureID,a.IsBranch,a.UnitManName,a.PostNumber,a.ExectiveID,'+
'b.govername as b1,a.SubExectiveID,c.govername,a.Commu_Address, '+
'a.starttime,a.stoptime,a.state,a.pyime,a.wbime,a.memo '+
'from tb_b_HspBaseInfo a ,tb_b_city b,tb_b_city c '+
'where (a.ExectiveID=b.govercode) and (a.SubExectiveID=c.govercode) '+
'and (a.HspName like '+FieldValue+')';
end
else
sqlstr:='select a.HspID,a.HspName,a.HspCorpCode,a.HspCorpName,a.HankAccount,'+
'a.HankName,a.CureID,a.IsBranch,a.UnitManName,a.PostNumber,a.ExectiveID,'+
'b.govername as b1,a.SubExectiveID,c.govername,a.Commu_Address, '+
'a.starttime,a.stoptime,a.state,a.pyime,a.wbime,a.memo '+
'from tb_b_HspBaseInfo a ,tb_b_city b,tb_b_city c '+
'where (a.ExectiveID=b.govercode) and (a.SubExectiveID=c.govercode)' ;
Igetdef := CreateObject;
Igetapp := IGetdef as IAppserver;
Result:=Igetapp.AS_GetRecords('Examdsp2',-1,RecsOut,byte(Options),sqlstr,Params,OwnerData);
setcomplete;
except
on E:exceptiondo
begin
setabort;
Result:=s_false;
end;
end;
end;
//更新相应的多表:
function TCommdict02.UpHspBaseInfo(var Delta: OleVariant): HResult;
var
sqlstr:string;
begin
Result:=s_ok;
try
sqlstr:='select a.HspID,a.HspName,a.HspCorpCode,a.HspCorpName,a.HankAccount, '+
'a.HankName,a.CureID,a.IsBranch,a.UnitManName,a.PostNumber,a.ExectiveID, '+
'b.govername as b1,a.SubExectiveID,c.govername,a.Commu_Address, '+
'a.starttime,a.stoptime,a.state,a.pyime,a.wbime,a.memo '+
'from tb_b_HspBaseInfo a ,tb_b_city b,tb_b_city c '+
'where (a.ExectiveID=b.govercode) and (a.SubExectiveID=c.govercode)';
ApplyUpdate(Delta,sqlstr);
SetComplete;
except
Result:=s_false;
SetAbort;
end;
end;
这些都可以写在应用程序服务器上的
呵呵/有点长啊!