I'm trying to set the.DisplayMember property of a ComboBox in C#, but I want to bind it to multiple columns in the .DataSouce.
My SQL looks like this:
SELECT PersNbr, PersFirstName, PersMiddleName, PersLastName
FROM Pers WHERE PersNbr = :persNbr;
I'm saving this query in a DataTable so each column selected has it's own column in the Datatable.
I want to make the .DisplayMember a combination of PersFirstName + PersMiddleName + PersLastName so their full name appears like this:
comboBox.DisplayMemeber = "PersFirstName" + "PersMiddleName" + "PersLastName"
I know I can just to this on the query:
SELECT PersNbr, (PersFirstName || PersMiddleName || PersLastName) PersName
and then just do this:
comboBox.DisplayMember = "PersName";
but I don't want to do the formatting of data in the database layer since it's not supposed to be there.
How else can I achieve this in Winforms?