private void UI_Load(object sender, EventArgs e) { MySqlCommand cmd = new MySqlCommand(Query, pr.connection); if (pr.OpenConnection() == true) { MySqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { ListViewItem itm = new ListViewItem(dr["medicine"] + ""); itm.SubItems.Add(dr["doctor"] + ""); itm.SubItems.Add(dr["contact_no"] + ""); listView1.Items.Add(itm); } } pr.CloseConnection(); } }