Hi Devonl, thanks for your reply.
First I load a DataGrid with a list of Empresas where I show Codigo, Descripcion and Sector in the DataGrid, the code that I use to populate the DataGrid is :
ugEmpresas.DataSource = EmpresaBZ.List(miSession)
List method in the EmpresaBz class just does the following
Public Function List(ByVal session As ISession) As IList
Dim query As String
query = "from Empresa order by Descripcion"
List = ObjectBZ.Find(session, query)
End Function
Find method in the ObjectBZ class calls Nhibernate session Find method as it’s showed below:
Public Function Find(ByVal session As ISession, ByVal query As String) As IList
Find = session.Find(query)
End Function
After I populated the Datagrid, I load a Combobox with Sectores like this:
Private Sub CargoComboSector()
With Me.cboSector
.DataSource = SectorBZ.List(miSession)
.DisplayData = "Descripcion"
.ValueMember = "Id"
End With
End Sub
And the List method in the SectorBZ class does the following query
Public Function List(ByVal session As ISession) As IList
Dim query As String
query = "from Sector order by Descripcion"
List = ObjectBZ.Find(session, query)
End Function
|