Hi,
How do I present an entirty collection as "System.Collection.IEmunerable" ?
I'm attempting to bind my DAL to a charting control (Dandas.Net), and the ADO.NET example they give is as follows:
Dim fileNameString As String = "chartdata.mdb"
' initialize a connection string.
Dim myConnectionString As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & fileNameString
' define the database query.
Dim mySelectQuery As String = "SELECT * FROM CompanySales;"
' create a database connection object using the connection string.
Dim myConnection As OleDbConnection = New OleDbConnection(myConnectionString)
' create a database command on the connection using query.
Dim myCommand As OleDbCommand = New OleDbCommand(mySelectQuery, myConnection)
' open the connection.
myCommand.Connection.Open()
' create a database reader.
Dim myReader As OleDbDataReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection)
' We optionally specify the Name column to be used for point's X values.
Chart1.DataBindTable(myReader, "Name")
When i try
Dim EntityCol As New DAL.CTMS.CollectionClasses.REF_PRODUCTSCollection
Dim Entity As New DAL.CTMS.EntityClasses.REF_PRODUCTSEntity
Dim sorter As SortExpression = New SortExpression
sorter.Add(SortClauseFactory.Create(DAL.CTMS.REF_PRODUCTSFieldIndex.TITLE, SortOperator.Ascending))
EntityCol.GetMulti(Nothing, 0, sorter)
Chart1.DataBindTable(EntityCol.GetEnumerator(),"Title")
I just get a cast error.
I know EntityCol does contain the data I want, just not sure how to present the Entity object to the chart control.
Any ideas?
Many thanks
Simon