I am trying to bind to a listbox. I am new to LLBLGen Pro and so far I like it.
What I need help with is how to populate a Asp.Net listbox with the 'Company Name' and the ID. I only want to pull the columns from the database without all the other fields. Here is what I have so far:
--Vb.Net
Dim adapter As New DL.DatabaseSpecific.DataAccessAdapter
Dim fields As New DL.HelperClasses.ResultsetFields(2)
Dim GenCo As New DL.EntityClasses.GenCompanyEntity
fields.DefineField(DL.GenCompanyFieldIndex.Id, 0, "ID")
fields.DefineField(DL.GenCompanyFieldIndex.CompanyName, 1, "Company Name")
Dim dbTble As New DataTable
adapter = New DL.DatabaseSpecific.DataAccessAdapter
adapter.FetchTypedList(fields, dbTble, Nothing)
Me.lstCompanyNames.DataSource = dbTble
Me.lstCompanyNames.DataTextField = dbTble.Columns(1).ToString
Me.lstCompanyNames.DataValueField = dbTble.Columns(0).ToString
Page.DataBind()
I want to ensure that I am using the most effecient code possible. Is this correct? It works but doesnt mean it is the fastest/scalable code.
Thanx!
~Mann.