property Tree.DataSource as Object
Retrieves or sets a value that indicates the data source for object.

TypeDescription
Object An ADO or DAO Recordset object used to fill data from.
The /COM version provides ADO, ADODB and DAO database support. The DataSource property takes a recordset and add a column for each field found, and add a new item for each record in the recordset. Use the Visible property to hide a column. Use the CellCaption property to retrieves the value of the cell. Use the PutItems to load an array to the control. Use the ConditionalFormats method to apply formats to a cell or range of cells, and have that formatting change depending on the value of the cell or the value of a formula. Use the DefaultItemHeight property before setting a DataSource property to specify the 

The /NET version provides the following methods for data binding:

Click here to watch a movie on how to assign a data source to the control, in design mode, for /NET assembly.

The following VB sample binds an ADO recordset to the ExTree control:

Set rs = CreateObject("ADODB.Recordset")
rs.Open "Orders", "Provider=Microsoft.Jet.OLEDB.3.51;Data Source= D:\Program Files\Microsoft Visual Studio\VB98\NWIND.MDB", 3 ' Opens the table using static mode

Set Tree1.DataSource = rs

The DataSource clears the columns collection, and fill the record set into the tree, like a list. Use SetParent method to make your list a hierarchy.

The following C++ sample binds a table to the control:

#include "Items.h"
#include "Columns.h"
#include "Column.h"

#pragma warning( disable : 4146 )
#import <msado15.dll> rename ( "EOF", "adoEOF" )
using namespace ADODB;

_RecordsetPtr spRecordset;
if ( SUCCEEDED( spRecordset.CreateInstance( "ADODB.Recordset") ) )
{
	// Builds the connection string.
	CString strTableName = "Employees", strConnection = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
	CString strPath = "D:\\Program Files\\Microsoft Visual Studio\\VB98\\NWIND.MDB";
	strConnection += strPath;
	try
	{
		// Loads the table
		if ( SUCCEEDED( spRecordset->Open(_variant_t( (LPCTSTR)strTableName ), _variant_t((LPCTSTR)strConnection), adOpenStatic, adLockPessimistic, NULL ) ) )
		{
			m_tree.BeginUpdate();
			m_tree.SetColumnAutoResize( FALSE );
			m_tree.SetDataSource( spRecordset );
			m_tree.EndUpdate();
		}
	}
	catch ( _com_error& e )
	{
		AfxMessageBox( e.Description() );
	}
}

The #import statement imports definitions for ADODB type library, that's used to fill the control.