我在Delphi中开发Com接口,在asp中调用出现如下错误,请高手指点。procedure TTGVPServer.Login(uid, pwd: OleVariant; out SessionID,succ: OleVariant);
begin
try
GVPConn.Open;
with adoComm do
begin
if Active then close;
SQL.Clear;
SQL.Text:='select SessionID from LoginList where uid=:uid and pwd=:pwd';
Parameters[0].Value:=uid;
Parameters[1].Value:=pwd;
Open;
if RecordCount = 1 then
begin
SessionID:=Fields[0].AsString;
succ:=0;
end
else
begin
SessionID:='';
succ:=1; //非法帐号
end;
end;
Finally
GVPConn.Close;
end;
end;----------------在asp中-------------- set GVPServer=Server.CreateObject("GVPServer.TGVPServer")
GVPServer.Login "admin","admin",sessID,succ ‘2句
Response.Write(sessID)
set GVPServer=nothing
----------------------------------------------------------------
当执行第2句时出错:GVPServer.TGVPServer (0x80040E37)
如果不执行第2句就不会报错!
begin
try
GVPConn.Open;
with adoComm do
begin
if Active then close;
SQL.Clear;
SQL.Text:='select SessionID from LoginList where uid=:uid and pwd=:pwd';
Parameters[0].Value:=uid;
Parameters[1].Value:=pwd;
Open;
if RecordCount = 1 then
begin
SessionID:=Fields[0].AsString;
succ:=0;
end
else
begin
SessionID:='';
succ:=1; //非法帐号
end;
end;
Finally
GVPConn.Close;
end;
end;----------------在asp中-------------- set GVPServer=Server.CreateObject("GVPServer.TGVPServer")
GVPServer.Login "admin","admin",sessID,succ ‘2句
Response.Write(sessID)
set GVPServer=nothing
----------------------------------------------------------------
当执行第2句时出错:GVPServer.TGVPServer (0x80040E37)
如果不执行第2句就不会报错!
请帮我看看!unit RDM;{$WARN SYMBOL_PLATFORM OFF}interfaceuses
Windows, Messages, SysUtils, Classes, ComServ, ComObj, VCLCom, DataBkr,
DBClient, GVPServer_TLB, StdVcl, DB, ADODB;type
TTGVPServer = class(TRemoteDataModule, ITGVPServer)
GVPConn: TADOConnection;
adoComm: TADOQuery;
private
{ Private declarations }
protected
class procedure UpdateRegistry(Register: Boolean; const ClassID, ProgID: string); override;
procedure Login(uid, pwd: OleVariant; out SessionID, succ: OleVariant);
safecall;
public
{ Public declarations }
end;implementation{$R *.DFM}class procedure TTGVPServer.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
begin
if Register then
begin
inherited UpdateRegistry(Register, ClassID, ProgID);
EnableSocketTransport(ClassID);
EnableWebTransport(ClassID);
end else
begin
DisableSocketTransport(ClassID);
DisableWebTransport(ClassID);
inherited UpdateRegistry(Register, ClassID, ProgID);
end;
end;procedure TTGVPServer.Login(uid, pwd: OleVariant; out SessionID,succ: OleVariant);
begin
try
GVPConn.Open;
with adoComm do
begin
if Active then close;
SQL.Clear;
SQL.Text:='select SessionID from LoginList where uid=:uid and pwd=:pwd';
Parameters[0].Value:=uid;
Parameters[1].Value:=pwd;
Open;
if RecordCount = 1 then
begin
SessionID:=Fields[0].AsString;
succ:=0;
end
else
begin
SessionID:='';
succ:=1; //非法帐号
end;
end;
Finally
GVPConn.Close;
end;
end;initialization
TComponentFactory.Create(ComServer, TTGVPServer,
Class_TGVPServer, ciMultiInstance, tmApartment);
end.
if gvpServer <> nothing(??,对VB不太熟悉)
2.succ,SessionId是否需要事先定义,毕竟参数类型是OUT.
dim succ,SessionId...
gvpServer.login...
3.asp是否有权限访问gvpServer,asp程序的权限很低的,不同于其他本地程序.
如果你已经配置好了权限,还请指点一下我,我刚好碰到了这个问题.
http://expert.csdn.net/Expert/TopicView3.asp?id=1991512以上三点,只是猜测,供参考
如果是的,这个问题不算。:)在调用GVPServer.Login "admin","admin",sessID,succ之前先
dim sessID,succ
sessID = ""
succ = ""
怎样配置iis,让asp可以调用Com?
我事先已经定义succ,SessionId也不行!
当我在COM中添加一个没有参数的过程也不行.to: Huiz
不是用Active Server Object生成的,我生成步骤如下:
新建ActiveX Liblaray ------->TRemoteDataModule注:我在Delphi中调用正常!
而应用程序的权限是当前的登陆用户,应该属于USERS组,POWERUSER组,甚至ADMINISTRATOR组的.
所以好多资源应用程序可以访问,而asp程序不可以.