473,387 Members | 1,619 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,387 software developers and data experts.

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 PullADUserFromDisplayName(string displayName)
{
DirectoryEntry entry = new DirectoryEntry("LDAP://" +
ConfigurationSettings.AppSettings.Get("System_Acti veDirPath"));
DirectorySearcher mySearcher = new DirectorySearcher(entry);
mySearcher.Filter = "(&(objectClass=user)(displayname=" + displayName + "))";
SearchResult resEnt = mySearcher.FindOne();
try
{
return resEnt.Properties["samaccountname"][0].ToString();
}
catch
{
return "null";
}
}

Any help appreciated.

Cheers
Dan
Nov 19 '05 #1
0 943

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

Similar topics

0
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,...
1
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...
1
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...
39
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...
1
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...
8
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...
3
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...
14
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,...
7
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...
3
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....
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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.