473,402 Members | 2,072 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,402 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 17 '05 #1
3 2303
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 17 '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 17 '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.framework.aspnet
!
!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 17 '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_...
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...
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...
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...
2
by: Jim in Arizona | last post by:
I'm trying to do a check to see if a specific active directory user account exists in active directory AND a specific group. I can't seem to get the filter down right. I can do this to find a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.