I have the following:
Set objDomain = GetObject ("GC://RootDSE")
objADsPath = objDomain.Get("defaultNamingContext")
'response.write(objADsPath)
Set objDomain = Nothing
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.provider ="ADsDSOObject"
objConn.Properties("User ID") = "USER" 'domain account with read access to LDAP
objConn.Properties("Password") = "PASS" 'domain account password
objConn.Properties("Encrypt Password") = True
objConn.open "Active Directory Provider"
Set objCom = CreateObject("ADODB.Command")
Set objCom.ActiveConnection = objConn
objCom.CommandText ="select sAMAccountName as id, mail, sAMAccountName as label, sAMAccountName as value FROM 'GC://"+objADsPath+"' where sAMAccountname = '*"&Request.QueryString("term")&"*' ORDER by sAMAccountname"
I presumed I could alias the column names like I would do in SQL but it fails. Is it possible to do?