Well now I want to fill a listview with information from my Database, but I get the following error:
Can not add or insert item in more than one site. You must first remove it from its current location or clone it.
Current Code:
while (reader.Read())
{
lvi.Text = reader.GetString("Articulo");
lvi.SubItems.Add(reader.GetString("Costo"));
lvi.SubItems.Add(reader.GetString("Importancia"));
lstData.Items.Add(lvi);
}
connection.Close();
The first record if it executes correctly but then in the second is when I get this error.
List Code:
lstData.View = View.Details;
lstData.Columns.Add("Nombre");
lstData.Columns.Add("Precio");
lstData.Columns.Add("Importancia");
lstData.Columns[2].Width=110;
ListViewItem lvi = new ListViewItem();