I have the same problem friends, I understand how the DataTable
works but when I'm trying to load a ComboBox
through a query that contains 2 tables it shows me the System.DataRowView
private void CargarComboCentrales()
{
DataTable dt = null;
string query = "";
query = @"SELECT C.idCentral, E.nombreEdificio
FROM Centrales C INNER JOIN Edificios E
ON C.idEdificio=E.idEdificio
ORDER BY E.nombreEdificio";
if (Auxiliar.conexion.SqlSelectDataTable(query, ref dt))
{
cmbIdCentral.ValueMember = "C.idCentral";
cmbIdCentral.DisplayMember = "E.nombreEdificio";
cmbIdCentral.DataSource = dt;
}
}
When I run the query in SQLServer it works very well. And I do not see any examples of loading combobox through an inner join.
If someone helps me, I would really appreciate it. PD: * When the information is in the same table if you load the combo without problems.
Tables >
Buildings:
idEdificio
nombreEdificio
zonaEdificio
direccion
Centrals:
idCentral
idEdificio
extension
marca
modelo
I would like to load the idCentral with the name of the building
Greetings!