Posted By: d4jaj1 Custom Login Form - 07/20/00 03:21 AM
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
Posted By: d4jaj1 Re: Custom Login Form - 07/20/00 11:23 PM
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
© Allround Automations forums