ADO example (ASP)
This code can be found in
Chapter 28 of Active Directory, 3rd Edition
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the ASP code from this site.
<!--#include file="adovbs.inc" -->
<!--
' From the book "Active Directory, Third Edition"
' ISBN: 0-596-10173-2
-->
<!--#include file="adovbs.inc" -->
<HTML>
<HEAD>
<TITLE>Navigating a simple resultset using ADSI, ADO and ASP</TITLE>
</HEAD>
<BODY>
<%
On Error Resume Next
Set objConn = CreateObject("ADODB.Connection")
objConn.Provider = "ADSDSOObject"
objConn.Open "", "mycorp\administrator", "My-admin-password!"
Set objRS = objConn.Execute _
("<LDAP://dc=mycorp,dc=com>;" _
& "(&(objectCategory=person)(objectClass=user));Name,ADsPath;SubTree")
%>
<TABLE BORDER=1 COLS=<% = objRS.Fields.Count%>>
<TR>
<% For Each oField In objRS.Fields %>
<TH> <% = oField.Name %> </TH>
<% Next %>
</TR>
<% Do While Not objRS.EOF %>
<TR>
<% For Each oField In objRS.Fields %>
<TD ALIGN=LEFT>
<% If IsNull(oField) Then
Response.Write " "
Else
Response.Write oField.Value
End If %>
</TD>
<% Next
objRS.MoveNext %>
</TR>
<% Loop %>
</TABLE>
<%
objConn.Close
Set objRS = Nothing
%>
</BODY>
</HTML>
|
This code has been viewed 2283 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|