Public Class MyDataItem
Public m_EmployeeID As Integer
Public Property EmployeeID() As Integer
Get
Return m_EmployeeID
End Get
Set(ByVal value As Integer)
m_EmployeeID = value
End Set
End Property
Private m_LastName As String
Public Property LastName() As String
Get
Return m_LastName
End Get
Set(ByVal value As String)
m_LastName = value
End Set
End Property
Private m_ImageUrl As String
Public Property ImageUrl() As String
Get
Return m_ImageUrl
End Get
Set(ByVal value As String)
m_ImageUrl = value
End Set
End Property
End Class
Private Function GetDataSource() As List(Of MyDataItem)
Dim EmployeeID As Integer
Dim dataSource As New List(Of MyDataItem)()
Using connection As OleDbConnection = GetConnection()
Dim command As New OleDbCommand(String.Empty, connection)
command.CommandText = "SELECT [EmployeeID], [LastName], [Photo] FROM [Employees]"
connection.Open()
Dim reader As OleDbDataReader = command.ExecuteReader()
While reader.Read()
dataSource.Add(New MyDataItem() With { _
//how to call here EmployeeID = CInt(reader("EmployeeID")), _
//how to call here LastName = DirectCast(reader("LastName"), String), _
//how to call here ImageUrl = GetImageUrl(CInt(reader("EmployeeID")), ConvertOleObjectToByteArray(reader("Photo"))) _
})
End While
End Using
Return dataSource
End Function