Free Support Forum -

SetDataSource using an ICollection

I want to use Smart Markers that derive their data from an ICollection rather than from a DataSet.
The code below seems to compile but how do I reference the fields in the Spreadsheet?
With a DataSet I would use &=TableName.FieldName
How do I do this with an ICollection?

Dim oICollection as ICollection = getMyData()
Dim oDataView As DataView = New DataView(oICollection )


1. I checked the msdn. A Dataview cannot created on a ICollection.

2. Generally DataView is built on a DataTable. A DataTable will contains the TableName and FieldName.

3. To set an ICollection as data source, you can convert data in this ICollection to an Array. Then you can use SetDataSource(string variable, object[] dataArray) method. And the smart marker will be &=$VariableArray .

So is this what you are saying?

Dim oICollection As ICollection = getMyData()
Dim iCount As Integer = oICollection.Count()
Dim oObjects(iCount) As Object
oICollection.CopyTo(oObjects, 0)
oExcelDesigner.SetDataSource(“MyStuff”, oObjects)

The ICollection has the concept of FieldNames.
The question is the Smart Marker reference.

is it this?

&=MyStuff.FieldName1 &=MyStuff.FieldName2 etc

or is it something else?


Since you copy ICollection data to an one-dimension array, the smart marker should be: