如题,用Type Library Add 一个Method为 Login
打开xxx_TLB.pas有以下段落:
=========================================================================
// *********************************************************************//
// Interface: Iworkflow1ser
// Flags:     (4416) Dual OleAutomation Dispatchable
// GUID:      {7935DB8E-38B8-4F08-9A85-46CFFFD8E5C8}
// *********************************************************************//
  Iworkflow1ser = interface(IAppServer)
    ['{7935DB8E-38B8-4F08-9A85-46CFFFD8E5C8}']
    procedure Login(const UName: WideString; const UPassword: WideString); safecall;
  end;// *********************************************************************//
// DispIntf:  Iworkflow1serDisp
// Flags:     (4416) Dual OleAutomation Dispatchable
// GUID:      {7935DB8E-38B8-4F08-9A85-46CFFFD8E5C8}
// *********************************************************************//
  Iworkflow1serDisp = dispinterface
    ['{7935DB8E-38B8-4F08-9A85-46CFFFD8E5C8}']
    procedure Login(const UName: WideString; const UPassword: WideString); dispid 301;
    function AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant; MaxErrors: Integer; 
                             out ErrorCount: Integer; var OwnerData: OleVariant): OleVariant; dispid 20000000;
    function AS_GetRecords(const ProviderName: WideString; Count: Integer; out RecsOut: Integer; 
                           Options: Integer; const CommandText: WideString; var Params: OleVariant; 
                           var OwnerData: OleVariant): OleVariant; dispid 20000001;
    function AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant; dispid 20000002;
    function AS_GetProviderNames: OleVariant; dispid 20000003;
    function AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant; dispid 20000004;
    function AS_RowRequest(const ProviderName: WideString; Row: OleVariant; RequestType: Integer; 
                           var OwnerData: OleVariant): OleVariant; dispid 20000005;
    procedure AS_Execute(const ProviderName: WideString; const CommandText: WideString; 
                         var Params: OleVariant; var OwnerData: OleVariant); dispid 20000006;
  end;// *********************************************************************//
// The Class Coworkflow1ser provides a Create and CreateRemote method to          
// create instances of the default interface Iworkflow1ser exposed by              
// the CoClass workflow1ser. The functions are intended to be used by             
// clients wishing to automate the CoClass objects exposed by the         
// server of this typelibrary.                                            
// *********************************************************************//
  Coworkflow1ser = class
    class function Create: Iworkflow1ser;
    class function CreateRemote(const MachineName: string): Iworkflow1ser;
  end;implementationuses ComObj;class function Coworkflow1ser.Create: Iworkflow1ser;
begin
  Result := CreateComObject(CLASS_workflow1ser) as Iworkflow1ser;
end;class function Coworkflow1ser.CreateRemote(const MachineName: string): Iworkflow1ser;
begin
  Result := CreateRemoteComObject(MachineName, CLASS_workflow1ser) as Iworkflow1ser;
end;end.
=======================================================================
在RomoteDataModle的.pas中写入
=======================================================================
procedure Tworkflow1ser.Login(const UName, UPassword: WideString);
begin
  ADOC_1.Connected;
  with ADOQ_1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('SELECT user_name FROM tb_user WHERE user_name = '''+UName+'''AND user_pds = '''+UPassword+'''');
    Open;
  end;
end;
========================================================================
为何在ClientDataSet.AppServer中没有Login方法
还应该做些什么

解决方案 »

  1.   

    從 Type Library 看不出問題
      

  2.   

    在客户端调用时怎么写
    把ClientDataSet连上DCOMConnection,再把DCOMConnection连上Server就可以了吧
    是不是直接用ClientDataSet.AppServer.Login就可以
      

  3.   

    >>是不是直接用ClientDataSet.AppServer.Login就可以我理解是的!!可參考這裹看看:
    http://bdn.borland.com/article/0,1410,22571,00.html
      

  4.   

    参考论坛以前的帖子
    在客户端要引用xxx_TLB.pas ?我建在两个文件夹下的,难道还要把所有的xxx_TLB.xxx COPY过去,
      

  5.   

    参考2ccc.com试用得到以下结果
    ================================
    在Server端要用时,得用以下方法
    var aa :Iworkflow1ser;
    begin
      aa := Coworkflow1ser.Create;
      aa.Login('aa','bb');
    end;
    就可以调用了
    可是在Client端怎么调用呢?