Martin Barreda
asked on
MSAccess User List
Is there a way to list the user's accesing a MDB access database at a certain time?
1) i need the number of users
2) i need the name of that users
I need this, to ensure that backup operations and compact&repair operations, controlled by the application, can open in exclusive mode with share read/write deny. The name of the user tell me in wich PC is the application running (so get to it, and close the application).
I am using Delphi 7, embebed ADO components, Jet OleDB 4.
With user, i mean the name of the PC or the name of the user using the PC from where the application is running. There is nothing related to security in that word. Only the MDB has a password set, and the application set the connection with it.
MDB resides in a "server", and the other PCs access it from its unc path.
1) i need the number of users
2) i need the name of that users
I need this, to ensure that backup operations and compact&repair operations, controlled by the application, can open in exclusive mode with share read/write deny. The name of the user tell me in wich PC is the application running (so get to it, and close the application).
I am using Delphi 7, embebed ADO components, Jet OleDB 4.
With user, i mean the name of the PC or the name of the user using the PC from where the application is running. There is nothing related to security in that word. Only the MDB has a password set, and the application set the connection with it.
MDB resides in a "server", and the other PCs access it from its unc path.
ASKER
Is one ldb file created for each user? or only one that carries out all info?
I like MS recommendations... do you know how to translate that to delphi, something using TAdoConnection.OpenSchema? ??
I like MS recommendations... do you know how to translate that to delphi, something using TAdoConnection.OpenSchema?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's work!!! i make a little changes to adjust the function for me, and first i am getting only the number of users... not the names.
The mistake was to check for Fields[0].Name.... the name is in Value not Name...
Dispite that.... THANK YOU!!!
The mistake was to check for Fields[0].Name.... the name is in Value not Name...
Dispite that.... THANK YOU!!!
function UsuariosConectadosADO(var acADOConnection: TADOConnection; ListaUsuarios: TStrings): integer;
var ADODataSet: TADODataSet;
begin
Result := -1;
ListaUsuarios.Clear;
try
ADODataSet := TADODataSet.Create(nil);
if acADOConnection.Connected then
begin
acADOConnection.OpenSchema(siProviderSpecific,
EmptyParam,
'{947bb102-5d43-11d1-bdbf-00c04fb92675}',
ADODataSet);
with ADODataSet do
begin
First;
repeat
ListaUsuarios.Add(ADODataSet.Fields[0].Value);
Next;
until EOF;
end;
end;
ADODataSet.Free;
Result := ListaUsuarios.Count;
except
SysUtils.Abort;
end;
end;
Sorry about that, I didn't had a time to compile it, I am glad that your code is working.
Regards,
B.
Regards,
B.
- Or when someone connects to the database there is a file created for every logged user ex: db.ldb, that resides in the same folder with the database. The same file disappears when there is no connection, except after database crushes.
- Here is how Microsoft recommends to determine who is logged on to a database by using Microsoft Jet UserRoster in Access
Access 2000 http://support.microsoft.com/?id=198755
Access 2002/2003 http://support.microsoft.com/?id=285822