473,386 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

DirectorySearcher & sorting

I would like to do a search and have the results sorted by property 1
and then by property 2. My first thought had been

//set up the searching object and call it oSearch
oSearch.Sort.PropertyName = "Property1,Proptery2";

but that was unhappy. I can do a
oSearch.Sort.PropertyName = "Property1";
or
oSearch.Sort.PropertyName = "Property2";
without issue but I can not figure out how to do what I need. I took a
look at the System.DirectoryServices.SortOption and it doesn't seem to
do anything new either. I am dealing with a fairly large result set so I
REALLY do not want to have to do a sort myself after I get the results.

Thanks.

-Cam

Nov 13 '05 #1
3 11557
If you move the content into a DataTable, your first method would work.
o_Table.DefaultView.SortExpression="Prop1, Prop2"

Then use the datatable as the source of your data.

"Willy Denoyette [MVP]" <wi*************@skynet.be> wrote in message
news:ex*************@TK2MSFTNGP10.phx.gbl...
This is not possible, Active Directory supports only a single sort key.

Willy.

"cameron" <ca****************@appdepot.com> wrote in message

news:3F**************@appdepot.com...
I would like to do a search and have the results sorted by property 1
and then by property 2. My first thought had been

//set up the searching object and call it oSearch
oSearch.Sort.PropertyName = "Property1,Proptery2";

but that was unhappy. I can do a
oSearch.Sort.PropertyName = "Property1";
or
oSearch.Sort.PropertyName = "Property2";
without issue but I can not figure out how to do what I need. I took a
look at the System.DirectoryServices.SortOption and it doesn't seem to
do anything new either. I am dealing with a fairly large result set so I
REALLY do not want to have to do a sort myself after I get the results.

Thanks.

-Cam


Nov 13 '05 #2
Move the content? Copy the actual data from AD to a SQL table? Wouldn't
that be nasty expensive to do whenever I needed to search? Or is there a
way to access the underlaying Database object?

-Cam

David Waz... wrote:
If you move the content into a DataTable, your first method would work.
o_Table.DefaultView.SortExpression="Prop1, Prop2"

Then use the datatable as the source of your data.

"Willy Denoyette [MVP]" <wi*************@skynet.be> wrote in message
news:ex*************@TK2MSFTNGP10.phx.gbl...
This is not possible, Active Directory supports only a single sort key.

Willy.

"cameron" <ca****************@appdepot.com> wrote in message


news:3F**************@appdepot.com...
I would like to do a search and have the results sorted by property 1
and then by property 2. My first thought had been

//set up the searching object and call it oSearch
oSearch.Sort.PropertyName = "Property1,Proptery2";

but that was unhappy. I can do a
oSearch.Sort.PropertyName = "Property1";
or
oSearch.Sort.PropertyName = "Property2";
without issue but I can not figure out how to do what I need. I took a
look at the System.DirectoryServices.SortOption and it doesn't seem to
do anything new either. I am dealing with a fairly large result set so I
REALLY do not want to have to do a sort myself after I get the results.

Thanks.

-Cam



Nov 13 '05 #3
Hello Cam,

There is no need to copy all the AD data to SQL table? What we need to do
is to see whether it is possible to copy the search result into a dataset.

Please refer to http://www.dotnet247.com/247reference/msgs/1/9450.aspx.

Hope it helps.

Best regards,
yhhuang
VS.NET, Visual C++
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net? http://www.gotdotnet.com
--------------------
!Message-ID: <3F**************@appdepot.com>
!Date: Fri, 04 Jul 2003 14:31:58 -0600
!From: cameron <ca****************@appdepot.com>
!User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0)
Gecko/20020530
!X-Accept-Language: en-us, en
!MIME-Version: 1.0
!Subject: Re: DirectorySearcher & sorting
!References: <3F**************@appdepot.com>
<ex*************@TK2MSFTNGP10.phx.gbl>
<q4***************@newssvr23.news.prodigy.com>
!Content-Type: text/plain; charset=us-ascii; format=flowed
!Content-Transfer-Encoding: 7bit
!Newsgroups:
microsoft.public.dotnet.languages.csharp,microsoft .public.dotnet.framework.a
spnet
!NNTP-Posting-Host: hssxrg64-201-211-159.sasknet.sk.ca 64.201.211.159
!Lines: 1
!Path: cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
!Xref: cpmsftngxa09.phx.gbl microsoft.public.dotnet.framework.aspnet:32353
microsoft.public.dotnet.languages.csharp:30649
!X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
!
!Move the content? Copy the actual data from AD to a SQL table? Wouldn't
!that be nasty expensive to do whenever I needed to search? Or is there a
!way to access the underlaying Database object?
!
!-Cam
!
!David Waz... wrote:
!> If you move the content into a DataTable, your first method would work.
!> o_Table.DefaultView.SortExpression="Prop1, Prop2"
!>
!> Then use the datatable as the source of your data.
!>
!>
!>
!> "Willy Denoyette [MVP]" <wi*************@skynet.be> wrote in message
!> news:ex*************@TK2MSFTNGP10.phx.gbl...
!>
!>>This is not possible, Active Directory supports only a single sort key.
!>>
!>>Willy.
!>>
!>>"cameron" <ca****************@appdepot.com> wrote in message
!>
!> news:3F**************@appdepot.com...
!>
!>>>I would like to do a search and have the results sorted by property 1
!>>>and then by property 2. My first thought had been
!>>>
!>>>//set up the searching object and call it oSearch
!>>>oSearch.Sort.PropertyName = "Property1,Proptery2";
!>>>
!>>>but that was unhappy. I can do a
!>>>oSearch.Sort.PropertyName = "Property1";
!>>>or
!>>>oSearch.Sort.PropertyName = "Property2";
!>>>without issue but I can not figure out how to do what I need. I took a
!>>>look at the System.DirectoryServices.SortOption and it doesn't seem to
!>>>do anything new either. I am dealing with a fairly large result set so I
!>>>REALLY do not want to have to do a sort myself after I get the results.
!>>>
!>>>Thanks.
!>>>
!>>>-Cam
!>>>
!>>
!>>
!>>
!>
!>
!
!
!

Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Martin | last post by:
Hi I'm having trouble with the script below that it just won't do a correct ORDER BY for a date field. When executing the two SELECT TOP statements on their own the records are sorted...
2
by: yee young han | last post by:
I need a fast data structure and algorithm like below condition. (1) this data structure contain only 10,000 data entry. (2) data structure's one entry is like below typedef struct _DataEntry_...
27
by: Daniel Vallstrom | last post by:
I'm having problems with inconsistent floating point behavior resulting in e.g. assert( x > 0.0 && putchar('\n') && x == 0.0 ); holding. (Actually, my problem is the dual one where I get...
1
by: Sargas Atum | last post by:
Hi all, 1. I have a problem with cell selection in a table in a DataGrid. I dont want that anybody writes in the cells. That was not a problem I changed them to "read only", but if I am going...
5
by: Dave | last post by:
Hi All C# ADSI samples that I run cause unspecified errors. If I translate them into VB.NET they run fine. Here's an example: public string getEmail(string LDAPPath, string username) {...
4
by: cameron | last post by:
I have always been under the impression that LDAP was optimized for speed. Fast queries, fast access, slower writes. I have a block of data in LDAP and in SQL. Exact same data. The query is fast...
3
by: cameron | last post by:
I would like to do a search and have the results sorted by property 1 and then by property 2. My first thought had been //set up the searching object and call it oSearch...
0
by: Eph0nk | last post by:
Hi, I have two small questions concerning databounding an xml file to a datalist. 1. Can i do (ascending/descending) sorting on a certain field? 2. Is it possible to show onliy the first 5...
1
by: Jay | last post by:
I need to add a parameter to a directorysearcher.filter rather than using hard-coded text. I have the following code that finds all members of an AD group and then for each of those results tries...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.