Directory query speed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi
I have a query to a LDAP directory which is supposed to get a list of records to be displayed in an ASP.NET page
There is not many of them, almost 3 dozen. But the query is rather long, too long for a web page indeed
Is there a way to optimize such queries
Thank

Here what I'm doing

ldsSearch = New DirectorySearcher(deEntry
ldsSearch.SearchScope = SearchScope.OneLeve

dtTemp = New DataTable(
dtTemp.Columns.Add(New System.Data.DataColumn("code")
dtTemp.Columns.Add(New System.Data.DataColumn("name")

ldsSearch.Filter = "(&(tdvOrganizationType=" & strFiltre & ")(|(cn=A*)(cn=B*)))
ldsSearch.PropertiesToLoad.Add("cn"

srResults = ldsSearch.FindAl
For Each srResult In srResult
row = dtTemp.NewRo
row("code") = srResult.GetDirectoryEntry.Properties.Item("cn").Valu
row("nom") = URLDecode(row("code")
dtTemp.Rows.Add(row
Nex

'Sortin
rowTransfert = dtTemp.Select("", "code ASC"
dtTemp.Dispose(

dtSortie = New DataTable(
dtSortie.Columns.Add(New System.Data.DataColumn("code")
dtSortie.Columns.Add(New System.Data.DataColumn("name")

For Each row In rowTransfer
dtSortie.ImportRow(row
Nex

row = Nothin
rowTransfert = Nothin
srResults = Nothin
ldsSearch.Dispose(

Return (dtSortie)
 
Ooops wrong place

----- Marcus L. wrote: -----

hi,
I have a query to a LDAP directory which is supposed to get a list of records to be displayed in an ASP.NET page.
There is not many of them, almost 3 dozen. But the query is rather long, too long for a web page indeed.
Is there a way to optimize such queries?
Thanks

Here what I'm doing:


ldsSearch = New DirectorySearcher(deEntry)
ldsSearch.SearchScope = SearchScope.OneLevel

dtTemp = New DataTable()
dtTemp.Columns.Add(New System.Data.DataColumn("code"))
dtTemp.Columns.Add(New System.Data.DataColumn("name"))

ldsSearch.Filter = "(&(tdvOrganizationType=" & strFiltre & ")(|(cn=A*)(cn=B*)))"
ldsSearch.PropertiesToLoad.Add("cn")

srResults = ldsSearch.FindAll
For Each srResult In srResults
row = dtTemp.NewRow
row("code") = srResult.GetDirectoryEntry.Properties.Item("cn").Value
row("nom") = URLDecode(row("code"))
dtTemp.Rows.Add(row)
Next

'Sorting
rowTransfert = dtTemp.Select("", "code ASC")
dtTemp.Dispose()

dtSortie = New DataTable()
dtSortie.Columns.Add(New System.Data.DataColumn("code"))
dtSortie.Columns.Add(New System.Data.DataColumn("name"))

For Each row In rowTransfert
dtSortie.ImportRow(row)
Next


row = Nothing
rowTransfert = Nothing
srResults = Nothing
ldsSearch.Dispose()

Return (dtSortie)
 
Back
Top