10 Dec 2009

Search On the Profile System

Search On Profile System

This Method is used to search on the profile system with a query OLEDB

Query is the string to use for searching on the profile system EX: select GeneralInfo.org_id from Organization where GeneralInfo.description like '%mycomany%'

This Method return a non typed dataset!

Pay attention because Profile Oledb Query sintax doesn't support Or Condition and join condition! http://blogs.msdn.com/maxakbar/archive/2006/11/03/free-commerce-server-2007-sql-2005-visual-studio-web-and-c-express.aspx

public static DataSet FindProfiles(string query)

{

DataSet ds = new DataSet();

object recordsAffected;

int options = 0;

Connection csoledb = ProfileBase.ProfileSystem.CommerceOleDbProvider;

Recordset queryResults = csoledb.Execute(query, out recordsAffected, options);

try

{

using (OleDbDataAdapter adapter = new OleDbDataAdapter())

using (ds)

{

adapter.Fill(ds, queryResults, "table");

return ds;

}

}

finally

{

Marshal.ReleaseComObject(queryResults);

}

return ds;

}

No comments:

Post a Comment