-
Get NTlogin from Generic User
Using VB as front end.
Using Generic User (DBuser)who has all appropriate rights to all procedures
in database.
Problem is when using suser_sname(), either as default or in an update proc,
it supplies the login user into SQL Server, not the NT login name. I need
to trap the NT Login name. Does anyone know how to do this?
-
Re: Get NTlogin from Generic User
Heres how to do it in VB
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long
Public Function GetName() As String
Dim lSize As Long
Dim sBuffer As String
sBuffer = Space(255)
lSize = Len(sBuffer)
Call GetUserName(sBuffer, lSize)
If lSize > 0 Then
GetName = Left$(sBuffer, lSize)
Else
GetName = ""
End If
End Function
You could then pass this value as an argument to your stored procedure. I
am unsure if you can get the NTLogin for a generic user name.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks