473,847 Members | 1,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AD searches using LIKE

Hi guys

I'm allowing users to search my SQL database for Projects created by a
certain user. The user login stuff is all stored in AD.

Atm, I can get it to work so that if they type the full name "Dan Nash" for
example, it returns all the Projects I created.

However, it's a tad long-winded.

What I'd like to do is enable them to search for "Dan" and it find all my
projects, as well as any projects by other Dans.

I'm using the DisplayName property to get the samaccountname to search the
database with. Is there a way to do a LIKE type search on displayname?

Here's my current code...

private string PullADUserFromD isplayName(stri ng displayName)
{
DirectoryEntry entry = new DirectoryEntry( "LDAP://" +
ConfigurationSe ttings.AppSetti ngs.Get("System _ActiveDirPath" ));
DirectorySearch er mySearcher = new DirectorySearch er(entry);
mySearcher.Filt er = "(&(objectClass =user)(displayn ame=" + displayName + "))";
SearchResult resEnt = mySearcher.Find One();
try
{
return resEnt.Properti es["samaccountname "][0].ToString();
}
catch
{
return "null";
}
}

Any help appreciated.

Cheers
Dan
Nov 19 '05 #1
0 963

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

Similar topics

0
2057
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics, manifolds, science, physics, chemistry, law, legal, government, home, office, business, domain lookup, medical, travel, food, university students, searching, searchers, surfing, advanced search, search tools Chemistry, mathematics, physical sciences,...
1
1232
by: ArunPrakash | last post by:
Hi All, I have the following scenario. I have a table called Invoice. This has around 30 columns of which i have to do a retrieval based on filter conditions on 10 columns. These filters need to be partial searches i.e. for e.g the Customer name could be 'Arun', 'Parthiv', 'Aaron', now i should be able to search the customer as 'ar' and it should return 'Arun' and 'Parthiv'. My concern is there are 10 columns on which this like '%x%'...
1
1247
by: MnMs | last post by:
I've got a catalog (table) of products (records), which will undoubtedly grow to over 5000 records in months. This is in an Access 2000 mdb file behind an ASP page, and the products have full text descriptions. I want my customer to easily "search" the database table with a simple SQL query. I guess I'll use a LIKE operator to search the field with the product's long description. Problem: Noise words. i.e. - and, but, it, its, or,...
39
4430
by: Noticedtrends | last post by:
Can inference search-engines narrow-down the number of often irrelevant results, by using specific keywords; for the purpose of discerning emerging social & business trends? For example, if authors of content subconsciously mention the keywords "lately and noticed" within the same brief sentence, the reader may infer "an unintended message" through the process of "inferential scanning;" a method of noting "semantic anomalies" which may...
1
2532
by: boblotz2001 | last post by:
For anybody that implemented fuzzy searches in SQL Server or any other database for that matter. I have implemented edit distance algorithm, specifically q-grams, in SQL Server and wanted to get some opinions from anyone who used a similar algorithm in a DBMS. We are looking to implement fuzzy address search and are employing number of different techniques including synonyms for strings like "drive", "dr", "drv", etc... Number...
8
1677
by: DQ dont quit | last post by:
I'm currently working on a ASP.Net / C# / SQL 2000 project that involves the entering of keywords, that a web user enters, and then searching MSWord documents for those words. This information will then be used to perform weighted searches on the keywords and text of multiple MSWord documents. How might this best be accomplished? Should I perform Full Text Searches on the Word files or store the data in a database (by coping and pasting...
3
2138
by: ghat12 | last post by:
Hi, I have created a form containing 5 textfields/combo boxes and a command button to conduct searches for matching records. My results are currently displayed as a separate datasheet which is launched by specifying the query in the OnClick property of the command button. I would like to create a form that displays the results in a datasheet on the bottom portion of the same form. I understand that this requires using the form-subform...
14
3843
by: Jeff S. | last post by:
In a Windows Forms application I plan to have a collection of structs - each of which contains a bunch of properties describing a person (e.g., LastName, FirstName, EmployeeID, HomeAddress, ZipCode, etc). So each instance of the struct will describe a person - and about 900 instances (people) will be contained in the collection. Users must be able to search for a specific person by any of the properties (e.g., LastName, FirstName,...
7
2627
by: pbd22 | last post by:
Hi. I am somewhat new to this and would like some advice. I want to search my xml file using "keyword" search and return results based on "proximity matching" - in other words, since the search string will often not produce a direct match, the results will be based on proximity (50%, 20% 100%, etc). are there any good examples out there on how to do keyword searches on XML data? How should i set up my xml file so
3
2441
by: 9966 | last post by:
Well previously I've asked a lot of question regarding Travelling Salesman Problem and I got a lot of helpful feedback from here. Thanks again for helping me. Now I've completed the full code. Basically I'm implementing several searches on my code (Brute force, random search and heuristic search). So now I've to do some literature review on other searches that can also be implemented to solve this problem. Well, I'm not experienced in other...
0
9892
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10991
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10653
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10347
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7888
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7061
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5725
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4540
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4129
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.