I have a VB.net program that includes a DataGridView. The binding source pulls data from a table with as many as 250,000 records in the table, depending on how many people are logged in and currently using the program. The records to display in the dgv for a given user are filtered by the machine name like this:
Me.PCTSNUGZFILTERBindingSource.Filter = String.Format("MACHINE = '" & strMachine & "'")
The fill command is this:
Me.PCT_SNUGZ_FILTERTableAdapter3.Fill(Me.SHOPFLOOR_SNUGZ.PCT_SNUGZ_FILTER)
The user will see anywhere between 6,000 and 30,000 records, depending on how many orders are in the pipeline at that time.
Initially, it was taking up to 45 seconds to load the data and display it. I tracked the bottleneck down to three processes: 2 SQL stored procedures and the dgv.fill. Each process took about 15 seconds.
I worked on the SQL stored procs and reduced the time on one of them to less than 1 second and the other to less than 5 seconds.
However, I don't know how to speed up the dgv.fill process. I have studied available postings on the internet, but I haven't found anything yet that helps me. Does anyone know of ways that I can speed up the dgv.fill process?
T
Change your stored procedure to take the machine name as a parameter and only return the filtered rows.