function TRemoteMethods.GetSearchSQLData(const sSQLStr: string;
clientdataset: TClientDataSet; dbType: Integer = 0): Boolean;
var
v:
OleVariant;
begin
Result := False;
if (sSQLStr = ‘‘) or (not
Assigned(clientdataset)) then
Exit;
SQLConnection1.Connected :=
False;
try
try
SQLConnection1.Connected := True;
except
on E: Exception do
begin
SysLog.WriteLog(‘TRemoteMethods.GetSearchSQLData‘ + E.Message);
Exit;
end;
end;
// 执行
SqlServerMethod1.Close;
SqlServerMethod1.SQLConnection := nil;
SqlServerMethod1.ServerMethodName
:= ‘‘;
SqlServerMethod1.SQLConnection := SQLConnection1;
SqlServerMethod1.ServerMethodName := ‘TSysMethods.GetSearchSQLData‘;
try
SqlServerMethod1.ParamByName(‘SQLStr‘).AsString := sSQLStr;
SqlServerMethod1.ParamByName(‘DBType‘).AsInteger := dbType;
SqlServerMethod1.ExecuteMethod;
v := Null;
if
SqlServerMethod1.ParamByName(‘ReturnParameter‘).AsBoolean then
v :=
SqlServerMethod1.ParamByName(‘OV‘).Value;
if not VarIsNull(v) then
begin
clientdataset.Data := v;
Result := True;
end;
except
on E: Exception do
begin
SysLog.WriteLog(‘TRemoteMethods.GetSearchSQLData‘ + E.Message);
end;
end;
finally
SqlServerMethod1.Close;
SqlServerMethod1.SQLConnection := nil;
SqlServerMethod1.ServerMethodName
:= ‘‘;
SQLConnection1.Connected := False;
end;
end;
原文:http://www.cnblogs.com/hnxxcxg/p/3580446.html