Print Thread
Custom Login Form
#711 07/20/00 03:21 AM
Joined: Jul 2000
Posts: 12
Atlanta, GA USA
D
d4jaj1 Offline OP
Member
OP Offline
Member
D
Joined: Jul 2000
Posts: 12
Atlanta, GA USA
Hello,

I'm very new to DOA and I'm trying to create a custom login screen for my client application and can't seem to get it to work properly. To make this explanation easier, I'm using the 3-tier demo provided in the DOA installation. Basically, all I did was add another form with 2 edit boxes and a button. Here's the code on the server and client.

SERVER FUNCTION
function TServerDMClass.Login(const Username: WideString; const Password:WideString): WordBool;
begin
Result := DefaultInterface.Login(Username, Password);
end;

CLIENT
procedure TForm1.Button1Click(Sender: TObject);
begin
if RemoteServer.AppServer.Login(edit1.text, edit2.text) then
begin
application.CreateForm(tmainform, mainform);
mainform.DeptClientDataSet.Active := True;
mainform.EmpClientDataSet.Active := True;
mainform.ShowModal;
end
else begin
raise Exception.Create('Invalid username/password');
end;
end;

If I set the LoginPrompt of the DComConnection to True, the default dialog box appears no matter what code exists on the OnLogin event. If I attach this code to a button, at runtime I get an error message of "...EOLEError with message 'Variant does not reference an automation object'". When I set the LoginPrompt of the TDCOMConnection to false and move the above code to the DCOM's OnLogin event, the component
is connected without any password at all. Is this a bug? What exactly am I doing wrong?



------------------
----------
Jay


----------
Jay
Re: Custom Login Form
#712 07/20/00 11:23 PM
Joined: Jul 2000
Posts: 12
Atlanta, GA USA
D
d4jaj1 Offline OP
Member
OP Offline
Member
D
Joined: Jul 2000
Posts: 12
Atlanta, GA USA
Okay, I figured out what I was doing wrong. I placed the code on the DCOM's AfterConnect event instead of the logon. I thought AfterConnect occured after teh UserName & Password were verified and teh database opened. I now know (I think) it only referes to to connecting to the remote data module - not actually opening the database.

I have another question though. How do you disconnect a specific user from the app server? I modified the DOA 3-tier demo to add/remove the current user's username to a listbox on connect/destroy. I would like to add a popup menu that takes the username from the listbox and disconnects them from the server. The OracleSession LogOff procedure seems to want to log everyone off. Is it possible to disconnect a single user?

------------------
----------
Jay


----------
Jay

Moderated by  support 

Link Copied to Clipboard
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Release build 20200307)
Responsive Width:

PHP: 7.1.33 Page Time: 0.024s Queries: 14 (0.009s) Memory: 2.4987 MB (Peak: 3.0393 MB) Data Comp: Off Server Time: 2024-04-27 08:13:16 UTC
Valid HTML 5 and Valid CSS