客户端:
with DataModule1 do
begin
try
DCOMConnection1.AppServer.AS_ShowMsg(UserID,searchsucc);
except
ShowMessage('应用程序响应错误!');
exit;
end;
end;
中间层:RDM中,
procedure TReDataModule.AS_ShowMsg(UserID: OleVariant; out Flag: OleVariant);
begin
usermsgquery.Close;
usermsgquery.SQL.Clear;
usermsgquery.SQL.Add('select * from TUserMsg where UserID='''+UserID+'''');
usermsgquery.Open;
if usermsgquery.Eof then
begin
Flag:=0;//此用户不存在
end
else
begin
if usermsgquery.FieldValues['Mark']='N' then
begin
Flag:=1;
end
else
Flag:=2;
end;
end;错误提示:project XXX.exe raised exception class EoleError with message 'method 'As_ShowMsg' not supported by automation object'
with DataModule1 do
begin
try
DCOMConnection1.AppServer.AS_ShowMsg(UserID,searchsucc);
except
ShowMessage('应用程序响应错误!');
exit;
end;
end;
中间层:RDM中,
procedure TReDataModule.AS_ShowMsg(UserID: OleVariant; out Flag: OleVariant);
begin
usermsgquery.Close;
usermsgquery.SQL.Clear;
usermsgquery.SQL.Add('select * from TUserMsg where UserID='''+UserID+'''');
usermsgquery.Open;
if usermsgquery.Eof then
begin
Flag:=0;//此用户不存在
end
else
begin
if usermsgquery.FieldValues['Mark']='N' then
begin
Flag:=1;
end
else
Flag:=2;
end;
end;错误提示:project XXX.exe raised exception class EoleError with message 'method 'As_ShowMsg' not supported by automation object'
郁闷ING
var1 = DCOMConnection1.AppServer;var1.AS_ShowMsg(UserID,searchsucc);分开试一下呢?参数会不会有问题呢?接口是否已注册?最简单的办法是照书上写一个最简单的DEMO来TEST一下。
DCOMConnection1.Connected := True;
才可以调用
DCOMConnection1.AppServer