# Add multiple Database data columns in one ListView cell

**URL:** <https://forum.xojo.com/t/add-multiple-database-data-columns-in-one-listview-cell/54899>\
**Category:** Getting Started\
**Created:** [July 25, 2020, 6:19am UTC](https://forum.xojo.com/t/add-multiple-database-data-columns-in-one-listview-cell/54899 "2020-07-25T06:19:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fabrizio\_Cesare](https://forum.xojo.com/letter_avatar_proxy/v4/letter/f/f04885/32.png) [@Fabrizio\_Cesare](https://forum.xojo.com/u/Fabrizio_Cesare)\
**Post date:** [July 25, 2020, 6:19am UTC](https://forum.xojo.com/t/add-multiple-database-data-columns-in-one-listview-cell/54899/1 "2020-07-25T06:19:02Z")

</div>

Hi,  
is it possible to add multiple data taking from multiple columns in a Database and merging into one only cell in a ListView ?  
Actually i populate my ListView taking one column at time and inserting in each ListView cell, but how to merge in 1 cell of ListView for example data taken from Database Column 5 and 6 ?

[code]If data \<\> Nil Then  
For Each row As DatabaseRow In data  
ListView.AddRow(row.Column(“ID”).StringValue, row.Column(“Column1”).StringValue, row.Column(“Column2”).StringValue, \_  
row.Column(“Column3”).StringValue, row.Column(“Column4”).StringValue, row.Column(“Column5”).StringValue), \_  
row.Column(“Column6”).StringValue  
ListaView.RowTagAt(ListView.LastAddedRowIndex) = row.Column(“ID”).IntegerValue  
Next

data.Close  
End If[/code]

---

<div class="post-metadata">

**Author:** ![Fabrizio\_Cesare](https://forum.xojo.com/letter_avatar_proxy/v4/letter/f/f04885/32.png) [@Fabrizio\_Cesare](https://forum.xojo.com/u/Fabrizio_Cesare)\
**Post date:** [July 25, 2020, 6:47am UTC](https://forum.xojo.com/t/add-multiple-database-data-columns-in-one-listview-cell/54899/2 "2020-07-25T06:47:30Z")

</div>

Ok found it 🙂

[code]If data \<\> Nil Then  
For Each row As DatabaseRow In data  
ListView.AddRow(row.Column(“ID”).StringValue, row.Column(“Column1”).StringValue, row.Column(“Column2”).StringValue, \_  
row.Column(“Column3”).StringValue, row.Column(“Column4”).StringValue, row.Column(“Column5”).StringValue) \_  
+ row.Column(“Column6”).StringValue  
ListaView.RowTagAt(ListView.LastAddedRowIndex) = row.Column(“ID”).IntegerValue  
Next

data.Close  
End If[/code]

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [July 25, 2020, 7:23am UTC](https://forum.xojo.com/t/add-multiple-database-data-columns-in-one-listview-cell/54899/3 "2020-07-25T07:23:19Z")

</div>

please be aware that if you have many database rows (\>1000) this method will be very slow and unresponsive.  
and more if you’re using a remote database

---

<div class="post-metadata">

**Author:** ![Fabrizio\_Cesare](https://forum.xojo.com/letter_avatar_proxy/v4/letter/f/f04885/32.png) [@Fabrizio\_Cesare](https://forum.xojo.com/u/Fabrizio_Cesare)\
**Post date:** [July 25, 2020, 7:25am UTC](https://forum.xojo.com/t/add-multiple-database-data-columns-in-one-listview-cell/54899/4 "2020-07-25T07:25:49Z")

</div>

and how to improve in that case (large database) ?

---

<div class="post-metadata">

**Author:** ![Jean-Yves\_Pochez](https://forum.xojo.com/user_avatar/forum.xojo.com/jean-yves_pochez/32/21769_2.png) [@Jean-Yves\_Pochez](https://forum.xojo.com/u/Jean-Yves_Pochez)\
**Post date:** [July 25, 2020, 9:24am UTC](https://forum.xojo.com/t/add-multiple-database-data-columns-in-one-listview-cell/54899/5 "2020-07-25T09:24:33Z")

</div>

you must implement a paging system, requesting from the database only the rows that are really visible on the listbox.  
I used a containercontrol having a listbox and a scrollbar to do this. it is quite a job to do it, but is really worth it.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:31pm UTC](https://forum.xojo.com/t/add-multiple-database-data-columns-in-one-listview-cell/54899/6 "2021-04-29T16:31:01Z")

</div>


