dataserviceimpl.pas
来自「Delphi开发webservice的一套例子」· PAS 代码 · 共 59 行
PAS
59 行
{ Invokable implementation declaration unit for TDataService,
which implements IDataService }
unit DataServiceImpl;
interface
uses
DataServiceIntf, InvokeRegistry;
type
TDataService = class(TInterfacedObject, IDataService)
// Make sure you have your invokable logic implemented in IDataService
// first, then use CodeInsight(tm) to fill in this implementation
// section by pressing Ctrl+Space, marking all the interface
// declarations for IDataService, and pressing Enter.
// Once the declarations are inserted here, use ClassCompletion(tm)
// to write the implementation stubs by pressing Ctrl+Shift+C
public
function QueryMyData(const sSQLCommand : String; var vData : String) : Integer; stdcall;
function UpdateMyData(vData : String; var lErrorCount : Longint) : Integer; stdcall;
end;
implementation
uses ComObj;
procedure DataServiceFactory(out Obj: TObject);
begin
Obj := TDataService.Create;
end;
{ TDataService }
function TDataService.QueryMyData(const sSQLCommand: String;
var vData: String): Integer;
var
vObj : Variant;
begin
vObj := CreateOleObject('PDelphi6ADOServer.Delphi6ADOServer');
vObj.QueryMyData('Select * from employee', vData);
Result := S_OK;
end;
function TDataService.UpdateMyData(vData: String;
var lErrorCount: Integer): Integer;
var
vObj : Variant;
begin
vObj := CreateOleObject('PDelphi6ADOServer.Delphi6ADOServer');
vObj.UpdateMyData(vData, lErrorCount);
Result := S_Ok;
end;
initialization
InvRegistry.RegisterInvokableClass(TDataService, @DataServiceFactory);
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?