Board index » delphi » Getting User Name for a Pdox based system

Getting User Name for a Pdox based system

Hi there,

I am writing a simple database which requires a transaction log
listing who made a particular change.

An earlier post to this list said that you could use the 'BDE API
function DbiGetNetUserName' .

I have tried to locate this anywhere in the documentation to find out
how to use it, but cannot see it anywhere.

I have tried using it directly with no parameters, but it comes up as
an unrecognised variable.

Do I have to include some obscure unit in the USES clause to see it ?

Could someone give me an example of its use, or a pointer as to where
to find info about it, Please ?

A code snippet would be very helpful :-)

Thanks

Pe...@ucsalf.ac.uk

------ Is my .sig here ? I'm sure I put it somewhere --------

 

Re:Getting User Name for a Pdox based system


The Help file (bde32.hlp) is with the Borland Database Engine files
themselves for the 32 bit version (this help file seems to work properly
as an added bonus, unlike other Borland ones that could be {*word*75}ed
about). I don't know if a similar help file was released for the 16 bit
versions or if it was just available with the Database "Tools".

The syntax for DbiGetNextUserName is :

function DbiGetNetUserName(pszNetUserName : PChar) : DbiResult;

the uses clause should contain DbiTypes,DbiProcs and DbiErrs (don't
actually know if you need them all!) and it is used like :

function GetUserName : string;
var
   szUserName : array[0..32] of char;
begin
        if DbiGetNetUserName(szUserName) = DBIERR_NONE then
           Result := StrPas(szUserName)
        else Result := 'unknown';
end;

Hope this helps.

--
Robert Eccles

Re:Getting User Name for a Pdox based system


Quote
pe...@ucsalf.ac.uk (Peter Ryan) wrote:
>An earlier post to this list said that you could use the 'BDE API
>function DbiGetNetUserName' .
>...
>Do I have to include some obscure unit in the USES clause to see it ?

The BDE API is implemented in two DCU for Delphi1 (DbiProcs &
DbiTypes) See the DOC Subdirectorie for DbiProcs.int & DbiTypes.int.

In Delphi 2 only 1 DCU BDE.DCU with the BDE.int in the DOC
Subdirectorie...

Good Luck
Patrice

Other Threads