ASP to ASP.NET

  • Thread starter Thread starter sck10
  • Start date Start date
S

sck10

Hello,

I inherited the following piece of code.

Dim LDAP_CONN, LDAP_COM, RS, sql, strPrint, strFields
Set LDAP_CONN = CreateObject("ADODB.Connection")
LDAP_CONN.Provider = "ADsDSOObject"
LDAP_CONN.Open
Set LDAP_COM = CreateObject("ADODB.Command")
Set LDAP_COM.ActiveConnection = LDAP_CONN
sql = "SELECT employeeNumber, name FROM 'LDAP://ldap-uscentral.post..com'
WHERE employeenumber='" & HRID & "'"
Set RS = LDAP_CONN.Execute(sql)

My problem is how to declare LDAP_CONN and LDAP_COM since the database is
using a URL ('LDAP://ldap-uscentral.post.com'). Also, how would I use the
repeater tool with this instead of a recordset.
ASP.NET
Dim strSQL As String = "SELECT employeeNumber, name FROM
'LDAP://ldap-uscentral.post.com' WHERE employeenumber='" & HRID & "'"
Dim LDAP_CONN as NEW OleDbConnection
Dim LDAP_COM As New OleDbCommand(strSQL, LDAP_CONN)
Dim RS, strPrint as string="", strFields as string=""

LDAP_CONN.Provider = "ADsDSOObject"
LDAP_CONN.Open
LDAP_COM = CreateObject("ADODB.Command")
Set LDAP_COM.ActiveConnection = LDAP_CONN
 
Hi Sck10,

Welcome to .NET newsgroup.
As for the ADSI query problem you mentioned, in .net , we're recommend to
use the components under the System.DirectoryServices namespace which are
purely .net based classes and won't need COM interop with classic COM
interfaces. Here are some related reference in MSDN:

#Searching Active Directory Hierarchies
http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskSearchingActiveDirec
toryHierarchy.asp?frame=true

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
Back
Top