hello all,
I wanted to know if this is the best way to display about 9,000 + songs on a listview from a database. here's my code... any advice, suggestions would be great.
Code:Private Sub cmdSearch_Click() On Error Resume Next Dim rstNewSearch As ADODB.Recordset Set rstNewSearch = New ADODB.Recordset Text3.Enabled = True Text3.BackColor = &HFFFFFF Dim strmp3name As String ListViewMP3.ListItems.Clear IsSearchResult = True rstNewSearch.Open "SELECT DISTINCTROW * FROM Songs ORDER BY Song ASC", cnnKerb, adOpenForwardOnly, adLockReadOnly tmpChangecolors = fileGetFromIni("Settings", "ChangeColors", App.Path + "\settings.ini") If tmpChangecolors = "" Then tmpChangecolors = "0" Else End If If tmpChangecolors = 1 Then Do While Not rstNewSearch.EOF strmp3name = rstNewSearch!song ListViewMP3.ListItems.Add , , strmp3name ListViewMP3.ListItems(ListViewMP3.ListItems.Count).SubItems(1) = rstNewSearch!IDFolder ListViewMP3.ListItems(ListViewMP3.ListItems.Count).SubItems(2) = rstNewSearch!LastPlayed ListViewMP3.ListItems(ListViewMP3.ListItems.Count).SubItems(3) = rstNewSearch!LastPlayedDate ChangeColors rstNewSearch.MoveNext Loop ListViewMP3.Refresh Else Do While Not rstNewSearch.EOF strmp3name = rstNewSearch!song ListViewMP3.ListItems.Add , , strmp3name ListViewMP3.ListItems(ListViewMP3.ListItems.Count).SubItems(1) = rstNewSearch!IDFolder ListViewMP3.ListItems(ListViewMP3.ListItems.Count).SubItems(2) = rstNewSearch!LastPlayed ListViewMP3.ListItems(ListViewMP3.ListItems.Count).SubItems(3) = rstNewSearch!LastPlayedDate rstNewSearch.MoveNext Loop ListViewMP3.Refresh End If rstNewSearch.Close Set rstNewSearch = Nothing End Sub
Thank you guys in advance.![]()




Reply With Quote