Hi guys, I've got a database that's 13,000 lines long and I'm trying to load this into a string array when the program loads but it takes approx 5-6 minutes for it to load it.
I've got a MS Access database or an Excel file that I can load this information from, each has two rows: SVONo, Description
This is my current MS Access code:
Does anyone have any idea of how to make it faster?Code:Try cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\products.mdb" & ";") cn.Open() cmd = New OleDbCommand("SELECT * FROM tblStock ORDER BY SVONO ASC", cn) dr = cmd.ExecuteReader Dim i As Integer = 0 While dr.Read() strProducts(i) = dr(1) strDescriptions(i) = dr(2) maxProducts += 1 i += 1 End While Catch ex As Exception MsgBox(ex.ToString) End Try dr.Close() cn.Close()
Or does anyone have a better way?
I did have the idea of loading it by letting the user select the first letter and then only loading the ones that begin with that letter but I've got 4000-5000 'S' ones and it still takes about 2-3 minutes to load it
All I want is to load the data from the database or the excel file and then put the products into 'cboProducts' and the 'cboProducts AutoCompleSourceList' and the descriptions into the 'txtDescriptions' AutoCompleteSourceList and a string array.
Then when the user selects a product using 'cboProducts' the description will automatically be put into 'txtDescription'.
Thanks in advance, knxrb







Reply With Quote