如题,用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方法
还应该做些什么
打开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方法
还应该做些什么
解决方案 »
- delphibbs离线数据chm格式723M版本(05年3月版),bt种子
- 一个关于三层结构调用SQLSERVER存储过程的问题。。。
- 如何屏蔽EDIT上的右键
- 连接到如下数据库,connectionstring应该怎么写??
- dll 调用不会了,在线等待,急
- 小弟初学Delphi请各位推荐一下,Delphi的入门书!
- 小票文字居中打印
- 版主帮个忙!!http://www.csdn.net/expert/topic/738/738331.xml?temp=.6896173
- 请教:如何去掉Webbrower控件的滚动条和边框?
- 没有骗大家吧说了给大家派高分已经有很多的朋友得了。高分征答新问题?(dyydyy)
- 有关字段显示问题
- TDBEDIT
把ClientDataSet连上DCOMConnection,再把DCOMConnection连上Server就可以了吧
是不是直接用ClientDataSet.AppServer.Login就可以
http://bdn.borland.com/article/0,1410,22571,00.html
在客户端要引用xxx_TLB.pas ?我建在两个文件夹下的,难道还要把所有的xxx_TLB.xxx COPY过去,
================================
在Server端要用时,得用以下方法
var aa :Iworkflow1ser;
begin
aa := Coworkflow1ser.Create;
aa.Login('aa','bb');
end;
就可以调用了
可是在Client端怎么调用呢?