Advertisement
| 11.21.2008 at 04:13AM PST, ID: 23924744 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: |
'on error resume next
dim temp
temp = Main
dim conn
Function Main()
Set Conn = CreateObject("ADODB.Connection")
Mdb = "telefonbog.mdb"
Conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Mdb
DoIt
conn.Close
Set conn = Nothing
End Function
Sub DoIt
dim sql
dim rsOpg
Set rsOpg = CreateObject("ADODB.Recordset")
rsOpg.CursorType = 2 ' adOpenDynamic
rsOpg.CursorLocation = 3 ' adUseClient
rsOpg.LockType = 3 ' adLockOptimistic
rsOpg.Open "select * from medarbejder", conn
Set objNET = CreateObject("Wscript.Network")
Set oRoot = GetObject("LDAP://RootDSE")
strDomain = oRoot.Get("DefaultNamingContext")
Do while Not rsOpg.EOF
If len(rsOpg("lokation")) <> "" AND len(rsOpg("initialer")) <= 3 Then
strUsername = rsOpg("initialer")
strUserDomain = objNET.UserDomain
Set oCommand = CreateObject("ADODB.Command")
Set oConnection = CreateObject("ADODB.Connection")
oConnection.Provider = "ADsDSOObject"
oConnection.Open = "Active Directory Provider"
oCommand.ActiveConnection = oConnection
sQuery = "SELECT Company,Initials,title FROM 'LDAP://" & strDomain & "' WHERE sAMAccountName = '" & strUsername &"'"
oCommand.CommandText = sQuery
oCommand.Properties("Page Size") = 100
oCommand.Properties("Timeout") = 30
oCommand.Properties("Searchscope") = 2
oCommand.Properties("Cache Results") = False
Set oResults = oCommand.Execute
Msgbox strUsername &" "& oResults("title")
If NOT oResults.EOF Then
If rsopg("Email") <> "" Then
If NOT isNull(oResults("title")) Then
Msgbox strUsername &" "& oResults("title")
SQL2 = "UPDATE Medarbejder SET Stilling='"&oresults("title")&"' WHERE Initialer='"&strUsername&"'"
Conn.Execute(SQL2)
End If
End If
End If
Else
strUsername = ""
End If
rsOpg.MoveNext
Loop
rsOpg.Close
Set rsOpg = Nothing
End Sub
|
Advertisement