UserName Method

SQLServer.Login Object

Description

Returns the user that a login is associated with for a specific database.

Visual Basic

idUser = Login.UserName ( [DatabaseName :=] idDatabase )

C++

HRESULT pLogin->GetUserName (
SQLOLE_LPCSTR
idDatabase,
SQLOLE_LPBSTR pidUser );

Elements

Element Type Description

idUser Identifier Returned username
idDatabase Identifier Database to retrieve username from

Remarks

This is an indexed property.

Reference

sp_adduser