Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trubble getting data from a LDAP

Status
Not open for further replies.

RoKKos

Programmer
Feb 3, 2003
50
0
0
SE
I´m getting this error:

Provider error '80040e37'

Table does not exist.

/xxx/xxx/test2.asp, line 25


This is my code
Code:
<%@ Language=VBScript%>

<%
Option Explicit
Dim con,rs,Com
%>
<html>
<head>
	<title>LDAP test</title>
</head>
<body>
debug
<%
Set con = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
con.provider =&quot;ADsDSOObject&quot;
con.open &quot;Active Directory Provider&quot;
Set Com = CreateObject(&quot;ADODB.Command&quot;)
Set Com.ActiveConnection = con

Com.CommandText =&quot;SELECT name &quot; &_
	&quot; FROM 'LDAP://ldap.ronneby.adm/ou=Rbyhus,o=Adm' &quot; &_
	&quot; WHERE objectClass='user'&quot;
	
Set rs = Com.Execute <-- Line 25 ---

%>

<table border=&quot;0&quot; cellpadding=&quot;0&quot; bgcolor=&quot;#CCCCCC&quot;>

	<%
	if NOT rs.EOF then
		Do While Not rs.EOF 
		%>
		<tr>
			<td><% response.write rs(&quot;name&quot;)%></td>
		</tr>
		<%
		rs.MoveNext 
		Loop 
		rs.Close
	else
		response.write &quot;sorry, try again&quot;
	End If
	%>

</table>

dubug

</body>
</html>

Do anyone know what I am doing wrong
 
when using files or remote references that are singular ( meaning not databased environments ( multi table ) the from statement needs to speficy the name of the object not the reference, the connection needs to point to the location


like if you're doing a text based odbc on file test.txt then you do :

select * from test.txt where etc ...

i believe that your LDAP pointer is not finding it's target vs the target returning no such data environment.

 
Provider error '80040e37'

Table does not exist.

/phonebook/includes/test.asp, line 27

I get that error as well. I've gone a different route from RoKKos, so here's my code.

Code:
<%	
	Dim strName
	strName = "(sn=T*)"
    
' Create ADO connection using the ADSI OLE DB provider
	Dim objADOConnection
	Set objADOConnection = CreateObject("ADODB.Connection")
	objADOConnection.provider ="ADsDSOObject"
	objADOConnection.Open "Active Directory Provider"

    
' Create ADO commmand object and associate it with the connection
	Dim objADOCommand
	Set objADOCommand = CreateObject("ADODB.Command")
	Set objADOCommand.ActiveConnection = objADOConnection

    
' Create the command string using the four parts

	objADOCommand.CommandText = "<GC://DC=domain_name,DC=com>;(&(objectCategory=person)" & strName &");sn,givenName,mail,physicalDeliveryOfficeName,telephoneNumber;subtree"

	' Response.Write(objADOCommand.CommandText)
	Dim objADORecordset
	Set objADORecordset = objADOCommand.Execute
%>

Can someone tell me what the problem there is? This has been driving me nuts.

On a more trivial note, I've noticed that strings containing "<" and ">" are not displayed in Response.Write statements. I'm curious about this. Can anyone say why?

Please help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top