.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

SearchResultsCollection Contains Only One Entry

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :Windows Application

We are in the throws of testing our new AD in the midst of a new corporate OS (Win7) test, and am having a 'play' with searching the AD to see if the new Windows Server 2003 R2 version is any quicker than the old Windows Server 2000 one.

There are two things I'd like to do but am struggling to underatnd the correct syntax:

  1. Return a collection of records that match a specific property, i.e. officeLocation
  2. Select a collection of records by multiple criteria, i.e. officeLocation = x or y

I have the following code to address 1. above but each time it only returns one record:


        public static Hashtable GetActiveDirectoryUserData(string queryField, string queryValue)
DirectoryEntry directoryEntry = new DirectoryEntry("my.active.directory");
            // create a searcher based on the root entry and set the search filter to search for a 
            // collection of users based on a specific query...
            DirectorySearcher directorySearcher = new DirectorySearcher(directoryEntry)
                    // define the query filter...
                    Filter =


View Complete Post

More Related Resource Links

Basic Instincts: Dynamic Data Entry With XML Literals


Learn how to use Windows Presentation Foundation (WPF), XAML, and the deep XML support in Visual Basic to generate user interfaces dynamically.

Beth Massi

MSDN Magazine October 2008

Toolbox: User-Friendly UIs, Online Data Entry Controls, and More


Microsoft® Office is one of the most well-known and most-used consumer products. For many people, their only experience with a computer is when using Office, be it checking e-mail, creating presentations, or writing a document.

Scott Mitchell

MSDN Magazine February 2006

Vrooooom: How .NET and C# Drove an Entry in the DARPA Grand Challenge


Find out how the .NET Framework, a team of programmers, and a bunch of people from Carnegie Mellon University built an automated car to compete in the DARPA Grand Challenge. Along the way you get some inside tips on building an extensible real-time control architecture based on a whiteboard metaphor and implementing an accurate GPS-synchronized timer component for .NET.

John Hind

MSDN Magazine December 2004

How to create a single entry page for site collections in MOSS 2007



I have  7 site collections containing a few hundred team collaboration sites. Some users are internal (intranet) but most are external (extranet). Extranet users are experiencing problems with losing links to their sites and forgetting which URLs to use. So I would like to create a single entry page that all users can enter after the logon process, which shows a list of sites they have permission to access, and other user-specific information. Perhaps relevant documents, tasks, recently modified documents etc.

I know this sounds like a 'My Site' but we want to use use a general welcome page instead. We use Windows authentication.
What is the best way of doing this and is it something that can be done in SharePoing Designer or does it need to be done in Visual Studio?

Many thanks in advance.

System.EntryPointNotFoundException: Entry point was not found. when unit testing html helpers


I'm trying to unit test a very simple html helper but keep getting the following exception:

System.EntryPointNotFoundException: Entry point was not found.

public static string AdditionalUsersDropDownList( this HtmlHelper helper, int additionalUsers )


Dictionary<int, string> items = new Dictionary<int, string>( );

items.Add( 0, "None" );

for ( int i = 1; i <= 30; i++ )


items.Add( i, i.ToString( ) );


SelectList list =  new SelectList( items, "Key", "Value", additionalUsers );

return helper.DropDownList( "AdditionalUsers", list );


Data Entry

hi... my  requirement is to enter details like tyrenumber,purchasingdate and guarantee for each tyre in a vehicl,.the total number of tyres may vary from 2 to 12,which data controls shall i used to populate my database.. Thanks in advance

Prevent duplicate entry upon keypress

Hi, I have a form with 4 textboxes. How would I prevent the user from entering a duplicate value upon keypress? Thanks

LDAP - directory entry issue with out user and password using impersonate and windows authentication

Hi All I am using the below code to fetch the user information from LDAP             DirectoryEntry entry = new DirectoryEntry("LDAP://DEV");             DirectorySearcher searcher =  new DirectorySearcher(entry);             SearchResult result;             searcher.Filter = "samaccountname=testuser";             result = searcher.FindOne(); here i am using windows authentication always and along with that when i enable the impersonate = true ,  the code fails at "result = searcher.FindOne();" with message "object reference not set to instance of an object "  also with the same code if i give the username and password along with the impersonate tag >> it works  or if i am using the user and password along with the DirectoryEntry  object then also it will work  but it fails with same user that i gave in impersonate tag / directory entry object with windows authentication enabled  and the  user logged to the application and no username and password tag in directory entry / impersonate tag  Interesting thing is that  in our development server ,  i am able to execute the same code with out user name p

InfoPath Repeating Table - Force new row entry

Hi,Wondering if anyone has had a similar situation.. I have an InfoPath form with a repeating table. When the user completes a row and saves the doc, I want this to be non-editable, so any subsequent changes have to be added as new row. Seems simple enough, but maybe it's just been a long day.. :) Any suggestions?Thanks,Laura

Monitoring a database entry

Hi, I am  building a web application in which when I create an entry, I need to monitor a status for 10 minutes. I am not sure how I can achieve this?  I am entring the data to database as soon as the user creates the entry. I can obviously use a trigger to see if the status has been updated. But how can I get the database to check the entry 10 minutes after it has been created? I would really appreciate some useful feedback. Thanks 

Default Application "does not contain a static 'Main' method suitable for an entry point"

Hi, When I create a brand new WPF application project in Visual Studio 2010 and immediately try to run it, I get the error WpfApplication1.exe does not contain a static 'Main' method suitable for an entry point. App.xaml's build action is set to ApplicationDefinition. I think it's not generating App.g.cs. Does anyone know what's wrong?

I need only the most recent entry from a table.

I have the following tables: Prospect Table ------------------------------------------------------------------------------------------------ | prospect_id | prospect_first | prospect_last | prospect_phone | prospect_email    | ------------------------------------------------------------------------------------------------ |          1       | John              | Doe              | 1234567890      | email@email.com | ------------------------------------------------------------------------------------------------ Corp Table --------------------------- | corp_id | corp_name | --------------------------- |    1       |   My Corp   | ---------------------------- Stores Table ---------------------------------------- | store_id | store_name | corp_id | ---------------------------------------- |    1        | Main Store   |    1      | ---------------------------------------- Unitsize Table ---------------------- | us_id | us_desc | --------------------- |   1     | &

Best Approach for Time Entry System

 Hi folks, need to get some ideas on the best approach for writing a system to log employee and equipment hours, based on the database backend for Abra Timesheets.  This app will only be responsible for entering things like an intra-company group and division and will probably associate equipment hours with a particular person so it will log equipment hours along with the operator/user.  Of course, equipment hours will be able to be modified apart from an employee's hours.  The immediate requirement is that it be Web-based, but there may be a need for it to be disconnected as well.  Is this a job for a Silverlight interface with a dataform, with the potential that it be saved on the user's computer and use an XML data store temporarily when disconnected.  I suppose a smart client app executed from an intranet site could be possible as well?  Any better ideas of the right way to do this? TIA, Steve

How to display first entry blank in combobox ?

Hi. I checked many places but did not find anything solving my problem. I populate the combobox from sql db with data set. I have a problem when UI opened at the start combobox populated with data and I not need see the data at the start. There is C# code                   DataSet ds1 = new DataSet();                 SqlConnection con = new SqlConnection("Data Source=DAN-PC;Initial Catalog=Veolia;Integrated Security=True");                 SqlCommand cmd1 = new SqlCommand("SELECT CUSTOM_ALIAS, C_DESCRIPT FROM [MHGROUP].CUSTOM3", con);                 SqlDataAdapter sqlDa1 = new SqlDataAdapter();                 sqlDa1.SelectCommand = cmd1;                 sqlDa1.Fill(ds1);                  DivisonName.ItemsSource = ds1.Tables[0].DefaultView;               &nbs

Joining but only showing top entry for one join

  Lets say I have a join as follows: Select * from Table1 left outer join Table2 on Table1.ID = Table2.ID left outer join Table3 on Table1.ID = Table3.ID   Now, I want to be able to see every entry on Table1 and Table 2. However, I do not want Table3 to repeat its values. For example, I would like to see something like this:   Table1 ID Table2 ID Table3 ID 1 1 1 1   2 1   3 2 2 2 3 3 3 Is this possible?

extra entry on selectedindexchanged

Hello all,I'm working on a project (nearly complete!). On my page I have several textboxes(Textbox1-5) and a couple of buttons. One button(Button1) is a submit button; the other(Button2) brings up another textbox(Textbox6) and a button(Button3). Entering information in that textbox and clicking that button(Button3) brings up a gridview. Selecting a row in the grid enters the ID of that row into Textbox6 (code below). It's set up (or supposed to be) so that clicking the submit button (Button1) will enter a row into a table; but when when I select a row to enter the ID into Textbox6, it enters a row then. So when I click submit, another row is entered. One thing to point out: I created a sequence (my database is Oracle) to automatically assign a PK. So my question: how do I keep it from entering a row in the table on the selectedindexchange? When it does this it is, for example, 10101 on the selectedindexchange, followed by 10102 on the submit button click, both entries containing the same information. I had a similar issue like this on this same page when I click one of the other buttons. I fixed it by setting Enable to False. Is there a similar solution to my current issue?Protected Sub GridView2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView2.SelectedIndexChanged        Dim row As GridViewRo
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend