The UserName property returns the Microsoft® SQL Server™ 2000 database user, determining privilege for the current connection.
object.UserName [= value]
object
Expression that evaluates to an object in the Applies To list
value
String that specifies an existing SQL Server database user by name
String
Read/write
HRESULT GetUserName(SQLDMO_LPBSTR pRetVal);
HRESULT SetUserName(SQLDMO_LPCSTR NewValue);
Note SQL-DMO strings are always returned as OLE BSTR objects. A C/C++ application obtains a reference to the string. The application must release the reference using SysFreeString.
Members of the sysadmin fixed server role or db_owner fixed database role can set the UserName property to impersonate the database user specified. For more information, see SETUSER.