[dba-SQLServer]Connection String

David Emerson davide at dalyn.co.nz
Thu Apr 3 18:14:05 CST 2003


Thanks Francisco.

Another thing I found out today was that if you divide an integer by an 
integer SQL will round the result to an integer.  Using the ROUND() 
function doesn't help if you want decimal places.  My solution was to CAST 
one of the number as a float.  Another of Microsoft's features?

David

At 3/04/2003, you wrote:
>If you are using windows authentication then you can just use this.
>otherwise if you are using sql authentication you'll need to parse the
>string.
>
>'Use the following to get UserName
>Private Declare Function apiGetUserName Lib "advapi32.dll" Alias
>"GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
>
>Function fOSUserName() As String
>' Returns the network login name
>Dim lngLen As Long, lngx As Long
>Dim strUserName As String
>     strUserName = String$(254, 0)
>     lngLen = 255
>     lngx = apiGetUserName(strUserName, lngLen)
>     If lngx <> 0 Then
>         fOSUserName = Left$(strUserName, lngLen - 1)
>     Else
>         fOSUserName = ""
>     End If
>End Function
>
>-Francisco
>http://rcm.netfirms.com
>
>On Thursday, April 03, 2003 2:15 PM [GMT-8],
>David Emerson <davide at dalyn.co.nz> wrote:
>
>: AXP ADP/SQL2000.
>:
>: I can get the current Connection string by using
>: CurrentProject.Connection.ConnectionString.
>:
>: I want to be able to check the current user (User ID = xxx) and run
>: code based on who it is.  Is there a simple function to find out the
>: User or do I have to do string manipulation on the ConnectionString?
>:
>: Regards
>:
>: David Emerson
>: DALYN Software Ltd
>: 25b Cunliffe St, Johnsonville
>: Wellington, New Zealand
>: Ph/Fax (877) 456-1205
>:
>: _______________________________________________
>: dba-SQLServer mailing list
>: dba-SQLServer at databaseadvisors.com
>: http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>: http://www.databaseadvisors.com
>
>
>_______________________________________________
>dba-SQLServer mailing list
>dba-SQLServer at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>http://www.databaseadvisors.com



More information about the dba-SQLServer mailing list