I found an example with 3 foreach loop to do waht you say.
But I also found this
(
http://216.239.59.104/search?q=cache...ataset&hl=fr):
using System;
using System.Collections;
using System.Data;
using System.Data.OleDb;
class ADSql
{
static void Main(string[] args)
{
//set the OLEDB provider for Active Directory
OleDbConnection oledb = new
OleDbConnection("Provider=ADsDSOObject;");
oledb.Open();
//set attribute description list
string searchAttrs = "distinguishedName, objectCategory";
//set an ADsPath for the search base
string searchBase = "'LDAP://DC=isqre,DC=net'";
//set filter
string searchFilter = "objectClass='user'";
//build SQL query string
string searchQuery = "SELECT " + searchAttrs + " FROM " +
searchBase + " WHERE " + searchFilter;
OleDbDataAdapter oleDA = new OleDbDataAdapter(searchQuery,
oledb);
//object that will cache the data retrieved from AD
DataSet oleDS = new DataSet();
//retrieve data from AD
oleDA.Fill(oleDS,"obj");
oledb.Dispose();
oleDA.Dispose();
foreach (DataRow r in oleDS.Tables["obj"].Rows)
{ //process the result
Console.WriteLine("-->");
for (int i = 0; i < r.ItemArray.Length; i++)
Console.WriteLine(" {0}",r.ItemArray[i].ToString());
}
oleDS.Dispose();
}
}
What do you think of this solution ?
What about performance ?
"Sahil Malik [MVP]" wrote:
Well, it wouldn't be too hard to simply create datatables and load data rows
into it using a little loop - the code should be less than 1 page.
--
- Sahil Malik [MVP]
ADO.NET 2.0 book -
http://codebetter.com/blogs/sahil.ma.../13/63199.aspx
-------------------------------------------------------------------------------------------
"Ryo" <Ry*@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com... Hello !
I want to know if there are an easy way to put a SearchResultCollection
(resulting of a query on Active Directory) into a DataSet ?
Thanks;