I am populating the list view using mysql and i dont know how to avoid duplicate rows.
Code:Private Sub Btnrefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnrefresh.Click Using connection As New MySqlConnection(";") Using command As New MySqlCommand("SELECT Distinct name, type, uploaded, uploader, location FROM programs", connection) connection.Open() Using reader As MySqlDataReader = command.ExecuteReader() While (reader.Read()) Dim name As String = reader("name") Dim type As String = reader("type") Dim uploaded As String = reader("uploaded") Dim uploader As String = reader("uploader") Dim location As String = reader("location") Dim lv As ListViewItem = ListView1.Items.Add(location) lv.SubItems.Add(name) lv.SubItems.Add(type) lv.SubItems.Add(uploaded) lv.SubItems.Add(uploader) End While End Using End Using End Using End Sub




Reply With Quote