这是我的应用服务器的更新数据方法
function TLYSVR.SaveData(var Sql, Data: OleVariant;
MaxError: Integer): OleVariant;
var TmpQry:TMySQLQuery;
TmpDsp:TLYDataSetProvider;
TmpDataSource:TDataSource;
i:integer;
Temp:array of Variant;
mydata,OwnerData:OleVariant;
begin
TmpQry:=CreateQuery(true);
TmpDsp:=CreateProvider;
TmpDsp.DataSet :=TmpQry;
if not VarIsArray(Sql) then
begin
TmpQry.SQL.Add(GetSql(Sql,' 1=0 '));
TmpQry.SQLID:=Sql;
end else
begin
TmpQry.SQL.Add(GetSql(Sql[0],' 1=0 '));
TmpQry.SQLID:=Sql[0];
TmpDataSource:=CreateDataSource;
TmpDataSource.DataSet := TmpQry;
Temp:=Sql;
for i:=1 to high(Temp)do
CreateDetail(Sql,TmpDataSource);
end;
mydata:=Data ;
try
//此处调用解压缩、解密数据代码
//******************//
try
Mydata:=DeCompress(mydata);
OwnerData:=TmpDsp.ApplyUpdates(Mydata,MaxError,i);
setcomplete;
except
setabort;
end;
finally
if not(varisnull(OwnerData)or varisempty(OwnerData)) then
//返回错误时,再次调数据压缩代码
begin
result:=DoCompress(OwnerData);
result:=OwnerData;
end else
Result:=null;
freeDataSet;
end;
//******************//
end;